This is how I'd do it - remove the copy from its parent, then add it to the new parent.
Here's an example where I've got two groups selected and want to copy the first layer in the first group into the second group
var group1 = context.selection;
var group2 = context.selection;
var layer = group1.layers();
var copy = layer.duplicate();