You can get the COS id by doing "zmprov gc name" (where name is the name of the COS), look for the "zimbraId" value.
You can than use that to set the users via a script and the "modifyAccount" command:
zmprov ma
email@address.com zimbraCosId cosidvalue