I've figured out how to do this with awk, but I'd like to find a way to do it with sed too. What I've seen on StackOverflow either uses awk or is extremely cryptic, doesn't work, and doesn't offer any explanation to help me make it work. I have input like this:

Hello1 aaa

Hello2 bbb

Hello1 ccc

Hello1 ddd

And need output like this:

Hello1 aaa, ccc, ddd

Hello2 bbb

If you can explain the command, that would be fantastic. I've tried reading up on sed but it's still very confusing.