Hi,
Please understand that the tag “Microsoft Exchange Online Management” is for general questions related to Exchange Online. For your question about the script which is not supported in our community. But based on my personal experience, you could refer to https://devblogs.microsoft.com/scripting/get-exchange-online-mailbox-size-in-gb/ to find out about the use of ToMB().
Hope this helps!