Help Samsung Note keeps restarting )=


Hello i am new to this site so i dont know much.
But i am having this issue with my Galaxy Note
I recently purchased this phone of one of my friends and so far the phone was great. But i noticed the phone kept turning off . Once it would turn off, it would vibrate for a bit then turn back on. And this happens constantly now, I would leave it charging for a while and when i check on it, it seems as if it hasnt been charging. It would also turn off while its plugged it to the wall. So i factory restored it and it was working for a while and it turned off again
I had a feeling its the battery so i just ordered another online and should be here within the next couple days
But anybody else have any ideas?
I dont want to feel like i got a bad deal
Please let me know!