To ‘Move’ a group into another context and keep all of its original ‘properties’ - so it appears you have haven’t actually ‘Copied’ it - you make references to them apply them to the new ‘instance’, then erase the original group…
grp ### the reference to the original group
newgrp = cdef.entities.add_instance( grp.entities.parent, grp.transformation )
newgrp.material = grp.material
newgrp.layer = grp.layer
newgrp.name = grp.name
attds = grp.attribute_dictionaries
attds.each{|d|
n = d.name
d.each_pair{|k, v|
newgrp.set_attribute(n, k, v)
}
} if attds
### you can also transfer any other properties like hidden?, locked? etc
grp.erase!