Instead of removing then adding, use --replace :
This technical guide details how to view, add, assign, and remove vCenter license keys using the command line. 🛠️ Essential Tools for vCenter License Management vcenter license key command line
After adding a license to the inventory, you can assign it to one or more hosts using PowerCLI. Instead of removing then adding, use --replace :