Move all entities to new group

Yes, you must turn the ‘entities’ into an Array using .to_a

The other issue is that you cannot use:

some_entities_context.add_group(array_of_entities)

IF the some_entities_context if not the Sketchup.active_model.active_entities AND the array_of_entities is also entirely composed of ‘entities’ in that exact same context.

A sure-fired way to make a Bugslplat is to ‘cross-thread’ the entities_context and the listed_entities

The normal way to use add_group() is NOT to make a new group from [‘pre]selected’ entities; but rather to make a new empty group and then add your new entities directly into it…

new_group = some_entities_context.add_group()
new_group.entities.add_line(pt1, pt2)

And so on…
NOTE: you need to avoid making the empty group too soon, because SketchUp’s “Garbage Collection” deletes any empty definitions [groups/components], so try to make it and add entities into its entities context shortly afterwards…