I am very concerned your CPU is overheating and shutting down your MacBook. Is your fan on full blast when you turn on a few times or is it completely quiet? Your fan can be in full blast and not cool your system if it has gotten disconnected from a good contact/connection with the CPU.
Intel CPU's heat up very quickly if the fan isn't working or if it is not attached to the CPU. You may be able to go 10 or 15 minutes when you first warm up your computer for the day, but this 10-15 minutes can turn into 30 seconds if you try to power on immediately after a shutdown. If your warmed up MacBook keeps shutting down in 30 seconds, but your cold MacBook takes a few minutes to shut down, it's the fan or fan attachment to the CPU. If it sometimes won't power on but stays on longer if you let it stay off/cool down for 30 minutes that's another sign it is a CPU/fan issue.
Although it could be other things IF it's the heat as I suspect and it works kind of how I describe (in terms of the various times it takes to shut down) then your CPU can suffer damage by trying to run it hot w/ non-working cooling.
Next Step: Bring it up in Single-User mode (COMMAND-S) on power on and leave it at the text screen there for 30 minutes. Does it stay on the whole time or does it shut off? Does the fan come on during this time, or no? Any issue in single-user and it's hardware, and indicates it is likely the fan in your case.
If your CPU is overheating, and you haven't damaged it by too many numerous attempts to get it to stay on when it's shutting itself off for heat/safety reasons then it's not an expensive repair if caught early. Just use https://locate.apple.com to find an Apple Authorized Service Provider or Apple Store. If the fan just needs to be reattached and needs new thermal paste that's not expensive. Even if it needs a new fan altogether, that's not too expensive either.