Mac App Store: We could not complete your purchase - Unknown Error

Solution 1:

Quit your App Store application if it is open. Launch the terminal application and type the following command:

open $TMPDIR/../C/com.apple.appstore/

A folder named com.apple.appstore will open. Move all the files present in it to Trash. Restart your mac and launch the App Store again. Problem solved!

Solution 2:

The reason for this is that:

Your Xcode application was installed previously with a different Apple ID. I would suggest you to check if there is any account active still in @Internet Accounts. Remove it and also go to Profiles and check if there is MDM profile installed or not. If you have an MDM profile, you have to reach out your IT to fix it.

Also, sign out from Mac Store and iTunes, reboot and try to sign in back if there is no MDM profile installed on your Macbook.