Don’t know why you must use a variable. You could do this with an Item. It’s a well-known method.
First decide if you need your variable to survive between different runs of the same rules. (I think you do?)
If so, you’ll need to use global variables, not create new ones every time the rule runs.
Next, if you want to access a variable using a string with the target name, you will have to do it indirectly.
One way is to create a global Map object, and key it by name-string. This is like having an array indexed by name-string in other languages.