Try booting into Internet Recovery Mode using Command + Option + R to attempt to access the online macOS installer. Theoretically it should access the most recent compatible installer available.
Before doing this, I highly recommend creating a bootable macOS USB installer first while you still can. You need to be currently running at least macOS 10.11 El Capitan in order to access any installers that are in the App Store, otherwise you will need to first install macOS 10.11 by creating a bootable macOS 10.11 USB installer. Depending on the OS you are currently using on this laptop, you may need to use any other computer that can access the Internet to download the DMG installer for El Capitan, then copy it to this laptop. Read the instructions very carefully in the Apple article.
How to download and install macOS - Apple Support
Create a bootable installer for macOS - Apple Support
It always helps if we know the exact model of the Mac and version of macOS currently being used. You can get this information by clicking the Apple menu and selecting "About This Mac". If you laptop is not able to boot macOS, then you can get the exact model by entering the system serial number on the check coverage page here (please do not post the serial number on the forum since it is considered personal information):
Check Your Service and Support Coverage - Apple Support
There is a very good chance you have a failing hard drive which is why the installation is failing. Run DriveDx (free trial period) and post the complete text report here using the "Additional Text" icon which looks like a piece of paper on the forum editing toolbar.