I have a question about the csv file, does it need field names?
Also how many groups are there likely to be and will they change?
The simplest method to do this is to have a Parameter Query for each group with a single line of VBA code to send it to a csv file like this

DoCmd.TransferText acExportDelim, , _
"Trak3_Master_Query", "C:\Access Databases\yellowgroup.csv"

However if the groups are likely to change or be added to it will take more sophisticated VBA code.
Are the group names held in a Table for selection as they should be?