No need Twrp for rooting.
1. Find or redownload the TGZ** file for your current ROM or other rom.**use the boot img included of your rom.
2. Browse inside the zip file and find boot.img under the images folder
3. Copy this file to a temporary location in your PC first, and then transfer it to your phone
4. Install the desired version of Magisk app
5. Run the app and choose Install under Magisk
6. Choose Select and Patch a File, then select the boot.img that was transferred earlier
7. A process will run and create a new .img file in the same folder where the original one was
8. Transfer the new file to your PC in the same directory where fastboot.exe is located
9. Open a command prompt window in that same directory
10. Reboot your phone to fastboot mode and connect to PC, USB2.0 port. Check for connection by running command fastboot devices.
11. Run the command fastboot flash boot_ab magiskXXXX.img
Once it's completed, run command fastboot reboot and the phone should boot and be rooted.