Your iPhone is showing the typical symptoms of a bad or (partially) disconnected battery.
Since it will eventually charge after 20 minutes of staying plugged in, it means the battery is taking some charge, but depleting it almost at the same speed. If you turn it off, leave it plugged, it may charge faster.
This slow charging can be caused by the battery being partially unplugged if for some reason the bracket holding the battery connector is missing.
This can also be caused by the battery gone bad. The iPhone 6 is now two years old and I've started seeing more and more coming in with bad batteries.
If you let your phone keep restarting, you may end up with corrupt data and eventually your phone will need to be restored, and all the data erased. I hope you have a back-up. If not, and your data is valuable, turn it off and keep it off until you can install a new battery.
To first reseat the battery connector, and if that doesn't help, to replace the battery, follow this guide and I highly recommend the batteries iFixit are selling. I use them myself for my customers and have nothing but great things to say about them. Otherwise you may receive a bad battery and the phone will keep restarting. Bad batteries are a plague and are the general rule not the exception of what is found on eBay, Amazon, and even from specialized parts sellers.
When trying to replace the battery, do not for any reason pry at the battery by leveraging against the board. You will ruin it permanently.
If a new battery does not fix it, report back. There are other steps to follow, such as perform a restore in case, like I said, the firmware got corrupted.