hi friend,
I did this way...
Assuming that you have already the bootloader unlocked then you have to download the root tool (like Magisk v16 that you can find in a google search).
Second: place Magisk in the internal memory in the mobile
Third: flash TWRP (or the recovery you want) and once you are into recovery flash Magisk.zip
Do it at your own risk I won't accept any complaint about that.
And above all, please, read as much as you can about the way...it takes me almost 1 month (reading and checking lot of info and different ways for doing it)