After not getting any response, I started searching about this issue online and came across
this guide. Actually the problem was happening due to the outdated system file.
So the first thing which I did I check the corrupted system file by following these commands:
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
then reinstalled the game service.
After doing these tasks correctly when I launch Minecraft, I have no longer any issues while installing this. Now I enjoy playing the game.