You just need to use a different quoting mechanism. Double quotes allow command and variable substitution. Braces will keep their contents verbatim (inhibit substutition)
set fh [open $tmpFileName w]
puts $fh {set a [create_object]}
puts $fh {$a proc1_inside_a}
puts $fh {$a proc2_inside_a}
close $fh
Documentation is available:
- Tcl's very few syntax rules -- compare rule 4 vs rule 6
- the Tcl tutorial -- lessons 5 and 6 apply