I find it necessary to install Magisk, to get TWRP to stick. Try it.
Please share with us: You did so using @Junior Passos method (backup boot and system then restore them)? format data only? Any other wiping? No verity, f2fs fix flashing, no echo script required? Which Magisk version did you flashed? Under which OS version/security patch? Which device version you have? Is actually as simple as @Junior Passos states? Sorry too many questions, but It's just that I've encountered so many contradictions, different kinds of steps, unsuccessful and successful installs and stuff, that I'm suffering from information overload right now...
Sent from my Moto Z2 Play using XDA Labs