iPhone keeps restarting and fingerprint sensor sometimes doesn't work
I have an iPhone 5s running iOS 10.3.3. Sometimes it was randomly restarting and the fingerprint sensor didn't work.
Then one day it refused to boot, it just keeps displaying "connect to iTunes"
I then decided to update the OS to 11.2.5 after many error, mostly error 21 and sometimes 9.
Now the phone is updated to iOS 11.2.5 and the phone stills randomly restarting and sometimes fingerprint sensor doesn't work. Yesterday after the phone restarts, I cannot sign in to my apple ID on this phone. Sometimes it would tell me that verification failed, sometimes it doesn't say anything and just return to settings menu.
As additional information, this phone used to be my father's, he had done some repair to this phone, e.g he replaced the phone screen because it kind of pops off (but it can still be used normally), and he also replaced the body since it has so many scratches. the phone then sits unused from august 2017 until now.
Can anybody tell me/help me just what is happening/broken in my phone.
Any help is appreciated.
Is this a good question?