iPhone X is stuck on black screen and switches to apple logo
I was on my iPhone and it suddenly shut off without warning, I tried to turn it on but eventually gave up and put it in the charge to see if it would turn on. When I put it in the charge it would show my Lock Screen, when I put in my passcode it would turn on then shut down again, this happened around 3 times. After it had happened 3 times it would show the apple logo for around 5 seconds and the switch to a black screen for the same amount of time and keeps switching. I left it like that until the battery had drained, after it had no more charge I put it in the charger but it went back to switching from the apple logo to a black screen. if I hold the off button for a long time it shows the recovery mode screen, but if I hold the off button again it goes back to the back screen. Currently I have no other option than to keep it on the recovery mode screen and connect it to the laptop then update it, I did just that and now it shows this on my Mac. Am I doing this right, do I lose data by updating my phone through recovery mode, and is there any other option? Also when the phone was connected it went off the recovery mode screen and turned black, is that normal for the phone to do while updating it?
after I connected the phone again it shows this: