It's pretty easy - you just need to make a bootable installer on a USB drive (you make this via terminal commands, and it basically puts the MacOS installer onto the USB, ready for installation on your external SSD). You would then restart your iMac and hold the option key and follow the prompts to run the bootable installer USB, and install MacOS onto your external drive.
Tutorial
here.
Once you've done that, your internal iMac will still have the original MacOS install on it - you can switch back to it if you want / need to in future by holding the option key while rebooting (this will allow you to select which disk to boot from - i.e. internal or new SSD external). Handy if there is something on the old install that you forgot to backup / transfer. Once I was sure my migration was complete, I ended up formatting the internal drive using disk utility and I just use it for additional storage.
As I said, it's pretty easy once you familiarise yourself with the process!
EDIT:
Forgot to say, when you reboot your iMac in future, it will just load the last disk automatically - so if you end up with just the external SSD for MacOS, it will boot from that automatically, so there will be no faffing about selecting a disk every time you turn it on!
EDIT 2:
Also, you can't really cock it up considering your original internal disk won't be getting overwritten - just be sure to select the new external SSD drive when installing MacOS from the USB installer. If it goes wrong, just unplug it all and your iMac should boot from the internal drive as normal! So defiantly worth a shot!