Can just use a summarise tool for this! I have attached the workflow for your desired outcome. I've used \n as the separator when concatenating as that achieves your desired output, but you could equally just concatenate them using a comma or something so the groupings would sit on one line (shown in the second screenshot).