My organisation is in the middle of a migration process and we have tons of shared mailbox in our on-premise environment that we are migrating. But have a problem, whereby we need to convert this shared mailbox to office 365 groups because of the feature of office 365 groups.
Is it possible to convert this shared mailbox to office365 Groups without loosing any previous data in the shared mailbox?
No, those are two very different objects and there's no "conversion" path. You can do it manually I suppose. The problem lies in the very limited options we have when it comes to ingesting data in Group mailboxes, so unless you want to do drag&drop operations via OWA, you'll have to write a custom solution using EWS/Graph API.