The essential problem is that you are storing names of groups, but those names do not associate, in any way, with the groups themselves. However, even giving them names is unnecessary, since you can always refer to them via select or in a forEach loop, since you are storing them in an array:
_group = TW_allopfor select 5; // Get a reference to the 6th group in the list.
{ ... do stuff to each group ... } forEach TW_allopfor;
You are overcomplicating things; I feel you could remove most of the code:
if !(isserver) exitwith {};
if (isNil("TW_allopfor")) then { //first time run?
TW_allopfor = [];
TW_totalmen = 0;
};
private ["_opfor"];
_opfor = _this select 0;
TW_allopfor set [count TW_allopfor, _opfor]; // push onto list of groups
TW_totalmen = TW_totalmen + (count units _opfor); //keep track of number of units
player sidechat format ["Added: %1, total groups: %2, total men: %3", _opfor, count TW_allopfor, TW_totalmen];
At any time, you can find out how many groups there are with count TW_allopfor, so there is not any need to keep separate counters for that.
I notice that you've used a tag on TW_INIT, but not on your other global variables. The point of the tag is that it is prepended to all your global variables, not just some of them (I've made the alteration above). Note that a 2-letter tag is not a valid OFPEC tag, which should be 3-5 letters long. Usually, if you are the mission-maker, tags are not compulsory; It only really matters if you are publishing your script to be used in other missions, where variable names could be being used for something else.
TW_allopfor now contains a list of all opfor groups ([group1, group2, ...]). You actually had a list of lists originally ([[group1], [group2], ...]) which was unnecessary complexity. You may need to simplify some other code to allow this to continue working, though, but this way is much clearer.
runto seems fine (~cough~ TW_runto). The problem was that you were just passing it a string name for a group, rather than the group itself.