An iMac 8,1 is a 2008 iMac which can run at most macOS 10.11 El Capitan.
There is no Internet Recovery Mode for this iMac. If it is running macOS 10.7 to 10.11, then you should be able to access local Recovery Mode using Command + Option + R so that you are not prompted for an AppleID when reinstalling whatever version of macOS 10.7-10.11 it is currently running.
Try Option Booting the iMac by holding the Option key immediately after hearing the startup chime. Can you access the Option Boot Apple boot picker menu? Or are you presented with a padlock?
Have you tried a PRAM Reset (hold it for at least three chimes)...is it able to do the PRAM Reset?
If it cannot reset the PRAM or access the Option Boot Apple boot picker menu, then there is some sort of hardware issue with the iMac.
If you want to create a bootable macOS 10.11 USB installer, then you can use the instructions in the following Apple article:
Create a bootable installer for macOS - Apple Support
Read the instructions for downloading & extracting the El Capitan installer into the Applications folder since there are multiple steps required which must be performed on a Mac generally from 2007 to 2015. You can use any computer or OS that can access the Internet to download the macOS 10.11 El Capitan DMG file for the installer, then transfer that file to a working Mac generally from 2007 to 2015 in order to extract the installer from the DMG into the Applications folder so you can make the bootable USB installer.
How to download and install macOS - Apple Support
I'm not sure what you hope to do with such an old iMac since macOS 10.11 El Capitan is very old so you will have difficulty finding any apps for it and for accessing any online services including the Internet. They usually shipped with very little memory by default and officially only supported 4GB max, but 6GB can sometimes work.
How much memory does this iMac have?
I would be surprised if the internal Hard Drive is not worn out or failing.
You may find the iMac