Try removing the battery and only power on with charger and see if its stable, also check the main air vent if its full of dust that is causing heating issues causes the laptop to switch off to prevent hardware damage. If possible when its stable enough download acronis hdd s.m.a.r.t software to check condition of hdd. Also other possible issue is failing battery, or both battery and dust heating causing issue combo.