You need to erase the whole physical drive (Intel Macs only). Within Disk Utility you may need to click "View" and select "Show All Devices" before the physical drives appear on the left pane of Disk Utility. The physical drive will usually be identified by the make & model of the drive. While file system you select for the drive depends on the version of macOS being installed. While booted to the macOS installer check to see what OS is listed for the "Reinstall macOS" option.
macOS 10.14+: Erase the physical drive as GUID partition and APFS (top option)
macOS 10.13 and earlier: Erase the physical drive as GUID partition and MacOS Extended (Journaled)
macOS 10.10 and earlier: Use the instructions in this article to partition & format the physical drive:
https://eshop.macsales.com/tech_center/formatting/Mac_Formatting_6-10_R3.pdf
I would be concerned if the hard drive is still healthy. Plus on some Apple laptops like the MBPro 13" (mid-2012) non-Retina model, the internal hard drive SATA Cable has a high rate of failure especially when using an SSD. It is easy enough to check the health of the drives if you can boot into a full macOS to run DriveDx, otherwise I can provide instructions for creating & using a bootable Linux USB stick to check the health of the drive. If the laptop has an original Apple drive installed, then you can try running the Apple Diagnostics to see if any hardware issues are detected, however, the diagnostics don't detect many of the drive failures and may not work with a third party drive.