Format the internal drive in Disk Utility as MAC OS Journalled, then back out and select Install MAC OS. You'll need an internet connection via WIFI to do that as it pulls the installer directly from Apple. I never use that method as its too slow, and installs the version of MAC OS it came with. Use a USB installer instead. I'm assuming this is a pre-2012 iMac, so High Sierra should work ok. Use this guide to create one..
https://dortania.github.io/OpenCore-...INSTALLER.html
Check what the highest version of MAC OS is supported on your iMAC. Prob High Sierra given it's age.
Use Option key on bootup to get to the bootpicker, and select the USB drive you created. This will at least get you to a more recent version of recovery. You can also use an external HDD connected via USB to install MAC OS on as well if you suspect the internal drive is stuffed.