If you look at the file trees in a hard drive, to erase and reinstall you start at the top-most.
Not at some lesser named part. ..The "friend" should have prepared the Mac before gifting.
• What to do before you sell, give away, or trade in your Mac - Apple Support
https://support.apple.com/en-us/HT201065
The suggestion to use "macOS Disk Utility, used in conjunction with macOS Recovery" should work.
There is a way to 'see the data tree' of failed drives, by a utility. This may be beyond your capability.
(Never install a newer macOS in hopes that may work to fix an older one's problem; fix older first.)
• How to reinstall macOS - Apple Support
https://support.apple.com/en-us/HT204904
[see the 'other options' section, for additional ideas]
• Use macOS Recovery on an Intel-based Mac - Apple Support
https://support.apple.com/guide/mac-help/use-macos-recovery-on-an-intel-based-mac-mchl338cf9a8/11.0/mac/11.0
Rather than be insulting, realize this is a hobby. Just being here as 'un-paid' Volunteer. Along this line
I had learning experience hands-on with repair, and donated over 600 Apple/Mac to charity; in past.
Among other avocational levels of experience doing many things. Are you too impatient to learn?
There are fairly good articles 'on how to,' among many dozens of user-friendly items in Apple Support.
Turn-off the TV and internet, go for a walk in the wilderness; ponder the meaning of life: a suggestion.
PS: a disc erase, hours long without end in sight, is an impractical unworkable means toward no gain.
