My dinosaur macbook randomly shuts down. I've reset the SMC and it still shuts down. Even the computer doesnt know its coming because you can hear the arm inside the hard drive clunk as it shuts down. If you leave it sit it will last longer on the next startup. Sometimes it wont even make it to the startup chime.
Try to boot macOS from external Hard Drive or SSD. If it's stable your internal disk is damaged.
Your MacBook is anywhere from 8 to as much as 11 years old. In my experience, you are looking at hardware failure. This is difficult to diagnose online and may be impossible to solve in a laptop form-factor, depending on what has failed.
I would start with a full Apple Hardware Test. You will likely need the discs that came with your computer or a 10.6 or earlier Applications Install Disc 2. This doesn't always catch hardware failures, but when it does, it can help you figure out how to fix it.
If this produces no information, you may need to open the case and confirm that all the internal connectors and wiring is securely attached and not damaged in any way. Look for cracks in the logic board. Confirm no debris is inside the case. Check to make sure RAM is securely inserted.
If you don't find anything obvious, I've heard anecdotal evidence that suggests old, cracked thermal paste on the CPU or GPU.
At this point, I would start to consider buying a new MacBook. If you were comfortable with your MacBook's processing power and speed, you can get a MacBook or MacBook for around $999. If you go refurbished, you are currently looking at something as low as $849.
(As an aside, there could be an issue with the battery or power adaptor. This is tough to troubleshoot as it requires a purchase of a new battery and/or power adaptor, which can be more than $100. I see that as $100 that could go to a new MacBook, so I can't say I recommend troubleshooting down that path unless you are certain that is the cause.)