OP:
Everymac.com says the pre-installed version of the OS that came with the 2015 iMac is 10.11 "El Capitan", and that it's supported all the way up to 10.12 "Monterey".
My suggestions:
- If you have 32 bit apps, and need to keep using them, then you want to install OS 10.14 "Mojave". Mojave was one of Apple's best OS releases, in my opinion. It's the last release of the OS that can still run 32 bit software.
- If you DON'T have or need 32 bit apps, you might as well "take it all the way" up to OS 12 "Monterey".
Having said that...
Trying to assess "where you are right now"?
Did you say that you have High Sierra up-and-running on the internal drive?
and...
You'd like to get it running on an EXTERNAL SSD drive?
and...
That you have an m2 drive in an external enclosure? What KIND of enclosure?
I know that nvme blade SSDs in a USB3.1 gen2 enclosure work fine as external boot drives...
BUT...
Not sure about m2 blade SSDs in external enclosures.
In any case, I'd like to offer a different method for getting High Sierra onto the external SSD.
Instead of doing a fresh OS install, have you considered using either CarbonCopyCloner or SuperDuper to do a "clone" from the internal drive onto the external SSD?
Both of these are FREE to download and use for 30 days, this will cost you nothing.
I suggest SuperDuper, its interface is a little easier if you've never used these apps before.
Just start SD, use your internal drive as the source, use the SSD as the target, and let SD do the rest.
It will even erase and prep the external drive before cloning.
See if this works.
When done, before you reboot, go to the startup disk pref pane.
Enter your password to unlock it, then set the SSD to be the boot drive.
Then, reboot.
How does that go?