Adding of groups is a fairly simple operation - it's enough to make a call of the corresponding method AddGroup. Most problematic in this situation is to obtain all the required parameters, namely roles' and vaults' IDs.
Vaults' IDs can be obtained by their names using the method GetKnowledgeVaultsByNames. Roles' IDs can be obtained by filtering all the objects with required criteria 'Name':
Full source code of program: