What you NEEDED to do was backup all our personal files, reformat the entire drive, and make a fresh install of XP.
What you DID do (?) is a mystery to us, because you have given no details of any kind, other than the computer shuts down by itself.
The cause is what you did. But we have no idea what you did, because you are not telling us.
Give the steps you did, one at a time, and the forum can probably spot the error.
The processor could be overheating. Check the CPU temp with speedfan or via the bios. Your power supply may also be faulty or your hardware may be connected to the PSU improperly. The computer will try to save itself by powering down during extreme events.