Hello hpr3,
Thanks for reaching out to us for support. We would love to help you. Just to make sure that we are on the same page, are you trying to erase everything on your iMac and do a clean install of macOS and then restore your files back to your iMac after the clean install? If so, we recommend that you first back up your data by following the instructions in the link below.
Back up your Mac with Time Machine
After you’ve created a back up of your data, steps in the links below will help show you how to erase your Mac, reinstall macOS, and restore your data back onto your Mac.
How to erase an Intel-based Mac
How to reinstall macOS
Restore your Mac from a backup
Please do not hesitate to reach back out to us if you have questions or need any additional support.
Thanks for using the Apple Support Communities.
Cheers!