OG assign existing content to group
You can use the og_group provided by the OG module.

  // The id of the group to which you need to assign the nodes
  $gid = 123;

  // The node which should be added to a group.
  $node = node_load(1);

  $values = array(
    'entity_type' =&gt; 'node',
    'entity' =&gt; $node,
    'state' =&gt; OG_STATE_ACTIVE,
  );

  //Add the current node to the group using the funciton provided by OG
  $result = og_group('node', $gid, $values);