Reinstall Windows 7 or 8 (which-soever applies for you) back to your computer (do a clean install and use your product key which had worked for you previously on Windows 7 or Windows 8) and activate your windows.
So, the solution is something which is going to take some time of yours again. Windows 7 or 8 Product Key Not Working in Windows 10 Trying even a product key of OEM not helping you with activation.
Rather you downloaded ISO from Microsoft website or any other reliable source or by using media creation tool, and did a clean install of Windows 10 over Windows 7 or Windows 8.1. If you just upgraded from Windows 7 or Windows 8 to Windows 10, but you didn’t chose the option path of letting Microsoft do it for you by upgrade reservation and informing you to upgrade.