You can connect the drive externally using a USB to SATA Adapter, drive dock, or enclosure to see if you have any better luck. If successful when the drive is connected externally, then the internal hard drive SATA Cable may be bad (or it may indicate a Logic Board failure). If your new "hard drive" is actually an SSD, then maybe the SSD is not compatible with the laptop. Not all SSDs are compatible with all computers.
I hope you invested in an SSD instead of a slow hard drive. An SSD will greatly increase performance of the laptop. But you need to be careful on which SSD you use since many SSDs today are just low end basic economy models which can be just as slow as a hard drive. The Crucial MX500 SSD is a good compromise on price & performance. Avoid the Crucial BX500 series SSD as it is a low end model which is very slow which tends to overheat easily and has a high rate of failure.
If you are booting a macOS 10.13+ installer, then you may need to click "View" within Disk Utility and select "Show All Devices" so that the physical drive appears on the left pane of Disk Utility. Select the physical drive which should be identified by the make & model of the drive and erase it as GUID partition and APFS (top option). If booting macOS 10.12 or earlier (perhaps even 10.13), then erase the whole physical drive as GUID partition and MacOS Extended (Journaled).