Get the exact model of the laptop by entering the system serial number on the check coverage page here (please do not post the serial number on this forum since it is considered personal information):
Check Your Service and Support Coverage - Apple Support
Try booting into Internet Recovery Mode using Command + Option + R to see if you can access the online High Sierra installer and to avoid booting to the internal recovery partition.
Do you have access to another working Mac from 2007 to mid-2018? If so, then you can use that other Mac to download & create a bootable macOS USB installer. The exact model of that other Mac will determine which version of macOS installer you can create.
If it is a 2010 Mac, then you can use the original gray OS X 10.6.x Snow Leopard Restoration DVD. If it is an earlier model, then you will need the OSX 10.6 Snow Leopard Upgrade DVD. Your friend should have these if it was a 2010 model & they should now be yours). Once you have Snow Leopard installed, then you can install macOS 10.11 (you will need to download it using any other computer & transfer the DMG to this Mac). If you have a 2011 or later model, then Internet Recovery Mode (Command + Option + R) or a bootable USB installer are your only options.
There is a good chance the laptop has some sort of hardware issue (sometimes people just want to get rid of junk so they pawn it off to unsuspecting friends). Try running the Apple Diagnostics to see if any hardware issues are detected. Unfortunately the diagnostics rarely detect issues, but it never hurts to try. A worn out or failing hard drive is a very likely possibility.