This sounds like the same question someone asked earlier this week. I recommend you search for the answer to that question. But in a nutshell your computer came with an OS license (or you bought one yourself). If you later update the OS either for free from MS or by buying an upgrade license then you have to repeat the process if you ever have to start over. Since you said you had Win7 and upgraded to Win10 then reinstall Win7 on the machine and then repeat the update process again. Your WIn7 license works with the Win7 version you'll install and the free update will allow the update.
If you already bought a Win10 license then you should have gotten the media too. Therefore you can skip the Win7 install and just install Win10 using your media and purchased license. After that you'll likely be "encouraged" to upgrade to Win11 for free.
Note that if you are using an MS account to log into Windows then it should have associated your Win10 license with your MS account. Therefore you should be able to install Win10 without a product key and then when you log into your MS account and activate windows it'll automatically retrieve the WIn10 license. But I'm not sure when that process started so I don't know if it applies in your situation or not.