the script has to assign a quota on each group (depending on the space-disk the group already uses). As a result, I have to obtain after a repquota -g :
Do you know what commands to use for finding the information you are looking for? If so, then think about how you would do this manually, and then put that logical thinking into a script which does the same.
First, figure out which shell or programming language you are going to use.
Second, find the commands that will gather the information you need (such as disk space, who is on what disk,....).
Third, start experimenting.
Post back what OS/version, what shell you are going to use, if this will be a manually run script or batch...