If I understand this correctly, this has nothing to do with -outreg-,
-estout- or any other program downstream. The problems are within your
own code.
You refer to `var' within your program -regse- without ever defining it
previously in the same program. This is not illegal but Stata will
interpret the reference to a non-existent macro as an empty string and
the result will presumably not be what you want.
That is, `var' within program -regse- is a local macro
name. The fact that the -foreach- loop outside your
program also uses a local macro name `var' has no implications
within your program. The two are in completely different
name spaces. That is precisely what the "local" of "local
macro" means.
One possibility is to pass `var' to -regse- in an option.