This is an attempt to write a canonical answer for drive error/faults and the importance of backing up data.
My iMac doesn’t start up. The loading bar doesn’t fill up and then,
after 10 minutes or so, it shuts down.
This is just one of the symptoms of a possible hard drive crash. It could be that it boots but is horribly slow. It could also boot and perform well, then suddenly crash (kernel panic). It could make horrible noise, or it could be as quiet as the day you bought it (SSD's of course).
In this particular case, it attempts to repair the volume, fails, then shuts down. This definitely points to a failed drive.
What to do...
Stop using your device and remove your drive. If you ever hope to have a chance at recovering your data you need to stop attempting to boot from it. Most of all, don't try to "stress" it in the hopes of making things better.
A Word on Backing up Your Data
Ironically, the last item mentioned is the most important:
(I haven‘t saved my files on a external hard drive and I don‘t want to
Whether you are using an iMac, a MacBook Pro, a PC or even working on an IBM mainframe, the very first thing you need to consider is backing up your data. Everything fails. Period. Whatever it is, at some point in time, it will fail. What we cannot predict with any certainty is when it will fail
Your operating system can be easily reinstalled. It may take a few weeks to tweak your settings just so, but that doctoral dissertation, picture of your family from last holiday, or file with the original recipe Coca-Cola will be gone - forever (generally speaking).
Backup is a very inexpensive insurance policy. You can recover your data, but at a very high cost. Would you rather pay $100USD for an external USB drive or thousands to a data recovery service?
Is it practical to backup your data now? Probably and personally, I would avoid using the drive until I could get set up with a fully functioning machine before I begin my data recovery attempts.
Replacing a Failed Drive
The specific iMac model wasn't referenced, but it really doesn't matter in the context of this answer. It could be a spinning hard drive or an SSD inside an iMac, Mac Pro, or MacBook. The drive has failed and it must be replaced.
"Rebuild" your Mac
To begin the process of rebuilding your Mac, you need to start with a clean slate and a fully functioning machine. You can't rebuild you car's engine or transmission while you're still driving it and you can't rebuild your data while operating on a faulty system.
Here's what you need to do:
The Recovery Process
Each one of these items has been address separately on this site and at many times linked back to Apple's own site (i.e. Using Time Machine).
One very important thing to note is that iCloud is not backup; it's file synchronization. Meaning if you delete it on one device, it's deleted everywhere.