The file will be a download, named "Install macOS Sierra", and it should be downloaded to the Applications folder on your external SSD. Just don't have it launch by itself after the download is complete. The next thing you should do is make a copy of it in another folder/location on your external SSD. Once you do that, you can double click on it, and do the clean, "virgin" installation of Sierra (should be V10.12.2) onto the internal drive on your iMac. Once that is complete, you'll be offered the opportunity, using Migration Assistant, to "migrate"/copy needed "stuff" from "somewhere" on your external SSD. Typically, that migration is done from a backup, but I do not know what you plan on doing. One thing, though, is that if you plan on doing such a migration, you need to insure that any third party apps you are using are compatible with Sierra. Myself, I did not "upgrade" (via a clean, virgin installation) from El Capitan to Sierra until November, as one of my third party apps, TechTool Pro, did not have an upgrade available for Sierra compatibility until then (I have 5 other third party apps that needed upgrades for Sierra compatibility, but they were available earlier (but still not when OS 10.12 first came out)).