I am searching through the menus. There are options to put the selection in either the find or replace fields of the search and replace toolbar.
But what I want is to replace for example the name of a variable inside a block of selected text ?
I don’t believe Script Debugger has that capability. I’ve written scripts that will do what you want, and they can be found here. Some of these scripts work with AppleScript’s dialogs, and others use free dialog programs. A screenshot of a version that uses the open-source swiftDialog: