Shared mailboxes don't need a license unless the mailbox has over 50GB of data. Follow these instructions to remove a license from a shared mailbox so that you can either assign it to a user or return the license so that you aren't paying for a license you don't need.
Remove the license
In the Office 365 admin center, go to Users > Active users.
Note: You'll need to remove the license from the Active users page. You can't remove the license from the Shared mailbox page because licenses are user settings.
Select the shared mailbox to view the user details.
Next to Product licenses, select Edit.
Toggle the license Off, and then select Save.
When you return to the Active users' page, it may take a few minutes for the user's status to refresh to Unlicensed.
After you've removed the license, you can do the following: