Chosen Solution

I put a PCIe blade SSD in it and it worked, what happened is that it gave me a black screen problem after I put it in. The system starts normally it is just that the screen is black you can even see the apple starting. I put the PCIe and the system started with Catalina but at the time of restarting to install Monterey it gave me that problem. Update (08/11/2022) @danj so this port cannot be used with this ssd and with a hdd at the same time

Yes! The Late 2012 21.5" iMac A1418 Custom Apple blade SSD is not PCIe/NVMe it is a custom mSATA implementation. So its not surprising you are encountering issues with a PCIe/NVMe drive. Here more info The Ultimate Guide to Apple’s Proprietary SSDs