It's a good start. To set column formulas by script, however, is a bit tricky as the argument is interpreted literally. Building a formula dynamically usually involves building strings or expressions that finally is parsed/evaluated. Otherwise local or session-specific variables will end up in the formula and it will not work as expected. At least that is my experience.
Here's an example using the string approach:
dt = Current Data Table();
N = N Col( dt );
s = "";
For( i = 1, i <= N, i++,
colname = Column( i ) << getname();
If( Contains( colname, "ToAdd" ) > 0,
s = s || If( Length( s ) > 0, ", ", "" ) || colname
);
);
show(s);
col = dt << New Column( "Sum(AddColumns)", numeric );
Eval( Parse( Eval Insert( "col<<set formula(sum(^s^))" ) ) );