So there are a few things more you can try before replacing a hard drive, unless prior to having these problems was base on replacing a Mac part or hard drive? Take your time in doing this the more it is forced to shutdown you are shocking the drive and board and make more things fail.
1st - unplug all devices and press and hold power button for 15 seconds yea longer than a window pc power flush.
Above process is performing an SMC Reset this is not a PRAM or NVRAM Reset those are different functions.
2nd - power in just the basic Display port, power cable, usb keyboard and usb mice preferably usb cord if possible.
3rd - Hold down cmd+S then press power button keep holding these keys until you see the loading bar you will notice the bar will be thinner than normal once it has loaded 25 percent of the way you can let go of the keys. This will place you in Single user mode in a non gui view, which is similar to Recovery mode utility.
Now there are many cmd's here you can type help and a list of items will appear for what you like to do, but most important you should do is type ' fsck -fy ' with out quotes and let it run it will look like windows dos mode.
This is perform a first aid/file system check on the hard drive and will check and fix any libraries or other directories, but when you look at it and say there is the same information like repairing and then shows results and then it seems stuck in the loop process, then it can very well be the hard drive.
Want to perform additional functions here is a list - but understand when these commands are run they will not ask you to confirm as you are in the root - like windows SuperUser (GOD Mode) so just do the fsck above and see where you go from there.
Reference Link - https://wiki.archlinux.org/index.php/fsc...
If the result return and does not prompt any errors you will be able to type shutdown or exit in rebooting the Mac and now you should be getting to the login screen or prompt window in a moment.