Of course first you need to create the group itself.

From a php script this could be done with:

<?php require('/var/www/fog/commons/base.inc.php'); FOGCore::getClass( 'Group' )->set('name', 'SomeNameToNameThisGroup') ->addHost(array(1,2,3,4,5,6)) ->save();

Of course change the array(1,2,3,4,5,6) with the list of ID’s you need to associate to the group.