The computer shuts down because it was not able to MOUINT the boot drive -- to get lots more stuff by name to finish booting up. It started a disk repair cycle, and when the was done, the disk would STILL not Mount. So it could go no further, and rather than staying powered off, It shuts down.
The conclusion is that you drive has too many errors to MOUNT successfully, even after a repair disk cycle.
You will need to at least re-install MacOS, which generally requires a disk that will Mount. So you will have to use another disk or erase the disk.
In a Mac before 2011 models, there is no ROM-resident Utilities, only the recovery partition already on the drive.
You can try:
using Recovery (command-R at startup)
Erase the drive
re-install MacOS.
Erase and reinstall macOS - Apple Support
.