How to merge multiple similar rows into unique rows in google sheets?

we have a task in hand

Current google sheets look like this

enter image description here

We want to make google sheets look like this

enter image description here

What we are currently doing?

  1. Select all similar rows
  2. Click on format menu -> merge -> merge vertically

What this is not working for us?
Our google sheets contains 2k rows, not possible for us to do manually for each row

What we are excepting?
Some formula or solution where we can do this automatically!