Start over.
Do this:
1. Boot to a special version of INTERNET recovery (this is NOT "the recovery partition):
shift option command R
You will need to enter your wifi password, IF you are connecting via wifi.
It will take some time to load, be patient.
2. Open disk utility.
3. IMPORTANT: Does disk utility have a "view" menu? If so, go there and choose "show all devices" (not all versions of disk utility have this choice -- if you don't see it, go to step 4)
4. Erase the internal drive. It's the TOP ITEM in the list on the left.
For Mojave or Catalina, choose APFS with GUID partition format
For High Sierra and earlier, choose Mac OS extended with journaling enabled, GUID partition format.
5. When the erase is done, quit disk utility and open the installer.
6. Begin clicking through. The Mac will restart one or more times, the screen may go dark for a minute or two (normal), and you may see one or more "progress bars". Be patient.
7. When the install is done, you should see the initial setup screen that says "choose your language"
STOP RIGHT HERE. DO NOT PROCEED FURTHER.
At this point, just reach around back and press and HOLD DOWN the power on button until the screen "goes dark".
WHY you did this:
When the new owner presses the power on button, the iMac will boot right back to that same setup screen... just like setting up a new iMac...