I would do following …
compute T1 group1 temp
compute T2 group2 temp
dump c_T1, c_T2 etc. as the thermo output. If you wish, you can time average it through post processing.
Now if you wish to check second part of lammps input, the easy check be…
make a system with two type of atoms. Put different thermostats for each species
at T1 and T2. now compute T1s and T2s from compute command.
and then you can write both commands
fix id group1 ave/time c_T1…*
fix id all ave/time c_T1…*
The output will tell you which method is correct or what… hopefully.