Hey lashphoton,
We'd be happy to help out. Sounds like you're currently on OS X Mountain Lion and having issues getting fully updated. We don't know what model iMac you have, so unable to determine the exact macOS version your iMac is compatible with.
Having said that though, you're going to run into trouble trying to fully update from OS X Mountain Lion, so instead, upgrade to OS X El Capitan 10.11 before attempting to fully upgrade to latest macOS version available for your iMac.
You'll find the link to download and install it here: How to download macOS
Once on OS X El Capitan 10.11, then try updating your Mac's software using the steps here: Update macOS on Mac
There it outlines the following:
Use Software Update
1. Before installing new software, it's a good idea to back up your Mac.
2. From the Apple menu in the corner of your screen:
• Choose System Settings. Then click General in the sidebar, and Software Update on the right.
• Or choose System Preferences. Then click Software Update.
3. If Software Update finds new software, click the Update Now or Upgrade Now button to install it.
4. Enter your administrator password, if asked. During installation, your Mac might restart, and you might see a progress bar or blank screen several times.
If Software Update says that your Mac is up to date, then no new software is currently available for your Mac model. Software Update shows only updates and upgrades that are compatible with your Mac.
We hope this helps out.
Take care!