If the iMac uses an internal Hard Drive or a Fusion Drive (a Fusion Drive contains both an SSD and a Hard Drive), then a simple erase with Disk Utility does not destroy the data on a Hard Drive. That data can be recovered using data recovery apps. You would need to use the "secure erase" option within Disk Utility (only available when using Disk Utility to erase a Hard Drive...not available for an SSD or a Fusion Drive setup). Or you could enable Filevault & let it finish encrypting the drive before performing a simple erase.
If the iMac only has an internal SSD, then the simple erase with Disk Utility is sufficient for destroying all data on the SSD due to how SSDs work.
Since you are recycling the iMac, then you can create & use a bootable ShredOS USB stick to overwrite the whole physical Hard Drive which will destroy all data on the Hard Drive.....assuming the Hard Drive is healthy enough. You can use the downloaded "ShredOS .img x86_64bit for USB Vanilla" IMG file as a source for Etcher (Mac, Windows, Linux) to create the bootable ShredOS USB stick for an Intel Mac (you can use any OS or computer to create it). Etcher does not install anything on the Mac & can be run from the Downloads folder.
Here is an Apple article for the proper steps for getting preparing a Mac to be give to someone else or for recycling. Unfortunately Apple's article doesn't consider that anyone still uses a Mac with an internal Hard Drive or Fusion Drive setup....Apple's article assumes only SSDs or a system with Filevault enabled. See my notes above for the "erase drive" step, otherwise the Apple instructions here are sufficient:
What to do before you sell, give away, trade in, or recycle your Mac - Apple Support
Now, for the High Sierra install error when using Internet Recovery Mode.....you can use Fix #3 in the following article:
https://mrmacintosh.com/how-to-fix-the-recovery-server-could-not-be-contacted-error-high-sierra-recovery-is-still-online-but-broken/
If the iMac has a Fusion Drive, then erasing the Hard Drive portion of the Fusion Drive will break the Fusion Drive. If you want to reinstall macOS after the secure erase of the Hard Drive, then you can just install it to the SSD (older iMacs had a 128GB SSD just large enough for an OS installation), or you can recreate the Fusion Drive setup with the instructions in the following Apple article:
How to fix a split Fusion Drive - Apple Support
FYI, there may be another option to continue using the iMac depending on the exact model. If it is an Intel Mac, then installing Linux Mint may be a good option to extend the useful life of the iMac assuming it has a good internal drive and 4GB of RAM. Could be make a good system for the kids. Linux Mint includes lots of free open source software within the Linux Mint software repositories including LibreOffice (similar to Microsoft Office), multiple graphics apps, audio apps, programming software, and even some games.