Chosen Solution

my phone keeps turning on and off by itsself and it keeps repeating the apple logo 2 times, and the battery percentage say 1% then in like a minute or so 16%

You may have just a bad battery..if you have a PC or Mac you can check its condition with 3Utools or Coconut battery. If battery is fine it might be a charging circuit issue, more likely if you used non original/MFi certified cables to charge it. In that case a logic board repair would be needed..not a DIY job.