How does the script group "group and ungroup" work,what is the diffrence between ungroup and unflatten

Hi, all. I have 2 questions:
1.I am little confused with the working processure: group + merge + ungroup(image below) : why I need firstly unify the 2 set of lines then split again, is there some direct way to do this? Maybe because I am not very clear with data screen here, need some experenced one tell me the principle.
2. When I read the tutorial, still , I need someone help me to explain the difference between “ungroup” and " unflatten", though I seek explaination on line, I cannot understand thorougly, too abstract, both of the questions are quite need logic thoughts.

Hope some one can help.
Thanks in advance!

In grasshopper, a “group” is a collection of shapes which acts as a single shape. It was added primarily to make it easier to transform multiple shape assemblies while keeping related shapes together.

So as far as grasshopper is concerned, as soon as objects go into a group, there’s only a single data item left to be dealt with.

Flatten is a very different operation, although there is some overlap in the symptoms. Flatten will take a nested structure of data (i.e. lists within lists) and put all values into a single (flat) list. This tends to destroy a lot of meta information and as such should be used sparingly, even if it does often seem to solve a particular problem in a file. You’ll often find that you’ll run into much more difficult subsequent problems downstream from a flatten operation.

Hi, David. Thanks! So, can I take group is a solution just makes shapes together, while "merge
" is to convert all shapes into one data family, and only when the shapes go through this process, they have same properties. Do not know my understanding right or not. Please correct me if wrong. Many thanks!
Thanks for expaination of “unflatten”, too!