Ok, solved.Get the firmware for your device off Xperifirm. Get UnSin and drag the Kernel sin file and drop over the unsin exe. This should make you a kernel img file you can fastboot flash to your device. After you do that, copy the same img to your device and patch it with magisk manager. then copy back to your adb directory and fastboot flash it, and you should have magisk root access - no bootloop
I flashed the stock ROM with EMMA (the software by Sony). Once the phone was up and running again, used the ROM downloaded with EMMA to extract the boot.img file, transfer it to the phone and patched it with Magisk, copied back to the PC and flashed with ADB.
Now everything is working fine.
Thank You all