Plain variables, or perhaps more correctly 'references', [e.g. x] are only used/changed in their specific def [method] that defines them.
Ones starting with @ [e.g. @x] - their current value is accessible to all methods during that instance of the class/module. Any method can define or redefine them,
Ones starting with @@ [e.g. @@x] are similar to @ ones, BUT their current value is remembered across multiple uses of that class/module - e.g. good for remebering values last used in dialogs. They need to be 'declared' outside of any method, but after that any method can then redefine them.
Constants [starting with a capital letter, or commonly with all caps, e.g. Z_AXIS] are similar to @@ ones, they are remembered across all uses of that class/method, BUT they are not readily changeable - because they are 'constants'!
Move your 'start_operation' out of the iteration block [to match the 'commit_'] that way all we become 'undo-able' in one go.
The selection.each{} block adds a piece of text to every selected object when the code starts.
However, the Sketchup.send_action("selectSelectionTool:") will stop more that one iteration.
It simply exits the tool and activates the 'Select' tool.
If you want to be able to 'pick objects' in turn you will need to [re]write/launch this as a proper Tool... this will involve getting input-points, reading mouse-positions and mouse-clicks etc... Then using those for new text objects etc...
See the API and examples - 'linetool.rb' etc - for some Tool method ideas/examples...
Or other authors' tools' .rb files - like say some of my 2dTools...
There is limited access to 'Text' objects' properties through the API - see the relevant pages - http://code.google.com/apis/sketchup/docs/ - height is not one of them - unless you make it as '3d-text'... It's a long standing request...