The square brackets ([ and ]) contain a filter condition. This is the same as a choice_filter for a select. That condition will be evaluated for each repeat instance of ${group_stock_out}. Notice that commodity_name_2 is not in ${}.
For each repeat instance of ${group_stock_out} that matches the condition in the square brackets, you will get the value for its quantityout. And that is what will be summed.
I haven't tried this yet. If you do try it out, please report back whether it works and if you have any other questions about this approach.