I understand you want to donate that Mac, but if you want it to be usable then you must first create a "bootable USB installer" of High Sierra according to Create a bootable installer - Apple Support. If you don't do that, then you can erase it, but it will not contain an operating system and there will be no way for you to install an operating system (see the italicized explanation • below).
Please consider that fact before contemplating erasing it. Once that Mac has been erased, there will be no other way to install High Sierra or any other operating system, other than that "bootable USB installer".
Refer to Use a bootable installer in How to download and install macOS - Apple Support for an explanation.
Then:
Refer to Use Disk Utility to erase an Intel-based Mac - Apple Support. In its Step 1, use the key chord ⌘ ⌥ R (three fingers: command - option - R) instead of ⌘ R as you have been doing. That will force the Internet version of Recovery instead of using the built-in Recovery partition which doesn't appear to be working in your case.
Once the Mac has been erased, Step 10 describes how to reinstall macOS... but it won't work, because Apple silently and inexplicably removed that ability several months ago.
The only way to reinstall High Sierra will be using that "bootable USB installer" you just created.
- Unless, of course, you have that iMac's original, grey, System Install DVD. Most people forgot about them soon after they unboxed their Macs over a decade ago.