Your iMac late 2011 can only upgrade as far as macOS High Sierra 10.13.6
so don't try Mojave, Catalina or Big Sur.
Apple only provides its installers via download from the Apple Servers.
Anything you buy on the net is illegal and may not be trustworthy, expired certificates
malware etc.
If you know someone who has a mac of a similar vintage ask them to
download High Sierra via this link, they must use Safari to click on the link.
How to get old versions of macOS – Apple Support
Go to the Download OS section and click on macOS High Sierra
this will redirect you to the App Store High Sierra download it
should say Get or Download.
If the App Store says ‘Open’ then it is detecting a previous download of the install app
go to the Applications folder locate Install macOS High Sierra.app.
Move it to the Trash, empty the Trash.
Restart, click on the link again, the App Store should say ‘Get' or 'Download'.
The Install macOS High Sierra.app downloads to the Applications folder should be 5.23GBs in size.
Create a bootable USB installer using the instructions here,
How to create a bootable installer for macOS – Apple Support
Once you have done that then you can insert the bootable USB
directly into your mac, boot to it and then install High Sierra.