You need to create a bootable OS installer thumb drive with High Sierra or newer as these macOS’s offer the needed NVM driver. What you are likely facing is the fact the internet recovery or your current OS is Sierra or older so they don’t have the needed driver.
To get you started plug in a 32GB thumb drive or larger. Now restart your system not Internet recovery. Using the disk Utility it offers in the menus format the USB drive and then install the OS to it. Reboot your system off of the USB drive and now go to this site [https://osxdaily.com/where-download-macos-installers/|How to Download MacOS Installers for New & Old Versions] to get the desired macOS. Update your USB drive or setup a second USB thumb drive (which is what I would do to be safe). Then after updating the thumb drive install the desired internal SSD, restart the system now with the High Sierra or newer USB drive and now format the internal SSD with the USBs Disk Utility and the. Install the os once more this time on the internal drive.