If you're just looking to reuse a piece of code in a bunch of different places you
could also use a tcl string for that as shown below
set code_to_reuse {
ns_write $var1
ns_write $var2
}
set var1 xxx
set var2 yyy
eval $code_to_reuse
set var1 123
set var2 456
eval $code_to_reuse