Sony Xperia Z stuck in a bootloop
You have to download a rom for your mobile.

Download it from

https://xperiastockrom.com/category/firmware

Download a flashtool from

https://developer.sony.com/develop/open-devices/get-started/flash-tool/


open the  flashtool
Connect a USB cable to your computer.
Turn off your phone.
Connect your phone to the USB cable while holding the Volume down key.
Select the software you want to flash in the Service list. The tool automatically detects the phone model and lists available software versions.
Click on Apply Service. The phone will now be flashed.
When you have flashed your device, you can disconnect your phone from the computer. The first time the boot-up might take a little longer than normal. 


Hope it will solve your problem...