Hi Aman,.
To figure out why your product key isn't working, try these steps before activating Windows.
First, use the Activation Troubleshooter in Settings > System > Activation to fix common problems automatically. Also, check that your Windows version matches the key; this info is in Settings >System > Activation. If they don't match, you might need a new key or to reinstall the right version.
If your screen freezes during activation, restart your computer or check for Windows updates. Some users say turning off Gaming Mode in Settings > Gaming can also help.
If the key still doesn't work, the seller may have already used it on too many devices, so ask them for a new one. You can also contact Microsoft Support to confirm the key is valid, especially if you bought it from them directly.