Which version of TWRP are you using?
Not every TWP version is equally suitable for every Android version!
I recommend not to use the current TWRP version 3.7.0 but an earlier version.
You can also install TWRP only temporarily and try to install Magisk-v25.2.zip with it.