How Do I Reference a Variable in an AppleScript?

Perhaps a better approach is for me to give you a complete example of a Dash search. I just uploaded this macro.

Note that it contains some specific Actions to deal with selecting text in the Script Editor, so you may want to adjust those to your needs.