Thank you so much for approving the post. But I have already resolved the issue.
Mainly the error was coming due to not sign-in both the Microsoft store and Xbox app with the same ID. So after logging-in with the same ID in both, I successfully installed Minecraft Java edition and I did not get any such kind of error code.