If shared mailbox accounts don't appear in the user selection list, you need to sync the shared mailbox on-premises AD accounts to Microsoft 365 or Office 365 by using Azure AD Connect. The shared mailbox AD accounts will appear as blocked accounts in the Microsoft 365 admin center, and you can select them from the user list.
Reference - https://learn.microsoft.com/en-us/Exchange/hybrid-deployment/move-mailboxes