Error deleting users from a Shared EmailBox PowerShell

I am playing with PowerShell script and I am trying to delete a list of users in O365 mailbox. I am using below commands but keep getting error as the input object cannot be bound to any parameters

Get-MailboxPermission -Identity $User | Where {($_.User -like "*Sharedmailbox@company.com")} | select "user" | Remove-MailboxPermission

The above commands give me the below error:
The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input