If you have any bootable clone backups of your startup disk, now would be the time to use them.
--------------------
A 21.5" Late 2009 iMac would have come with Snow Leopard, and a set of discs for installing Snow Leopard. (This was in the days before Recovery partitions and Internet Recovery.). If you have those discs, you could install Snow Leopard and then try upgrading to High Sierra.
Once you have Snow Leopard installed, you can probably upgrade to High Sierra in two steps:
- Download the .DMG file containing the Sierra installer (using another computer if necessary). Open (mount) the .DMG file on the iMac and run the Sierra installer.
- Using the versions of Safari and the App Store in Sierra, upgrade to High Sierra using the App Store link.
How to download and install macOS - Apple Support
--------------------
If you're trying to get Snow Leopard back to the point where you can try to use the Mac App Store, that might be a little bit more involved. The Snow Leopard recovery discs would have contained Mac OS X 10.6.1 or 10.6.2, and the Mac App Store didn't make an appearance until 10.6.8.
There are a bunch of Snow Leopard patches at Apple - Support - Downloads. Two of the really important ones are
Mac OS X 10.6.8 Update Combo v1.1
Mac App Store Update for OS X Snow Leopard
Apply them in that order. The first brings Snow Leopard up to 10.6.8 from any previous 10.6.* version. The second patches the App Store support in 10.6.8 to "ensure future compatibility of the Mac App Store". Once again, these may not be necessary if you can get any version of Snow Leopard, and the .DMG with the Sierra installer, onto the machine.