My macbook doesnt stay turned on
I Have a macbook white unibody purchased in 2011. The problem is that when you turn it on you have to press any key for it to made it to the home page. Once you are at homepage, if you stop typing or moving the cursor, it pop up the screen that says restart cancel shutdown if you dont press cancel quickly enough it turns off. (It does have battery charged and even pluggedin). I restored the hard disk and still making the same.
MacBook, iOS 9.3.1