Restart your mac and try it again, anytime I have come across a Disk that will not unmount
a Restart has sorted it out.
With the external disk connected open Terminal and type in
diskutil list
press Return
from the list make a note of disk identifier and then type
diskutil umount disk<whatever the identifier is, something like disk1s2>
press Return
this is just to see if it will unmount
to mount the disk again enter
diskutil mount disk?s?
press Return
if it unmounts and mounts then try Disk Utility again.
If there is only the macOS Mojave.app on the external then move it to your Desktop, erase it from the external drive, then simply double-click the Install macOS Mojave.app or whatever OS it is you
want on the external disk to start the installation process, go through the screens until you get to the section where you select which disk you want to install Mojave or whatever on.
Select the external disk.