transforming position to the location of a variable

i have an object, i need a script with to transform variables, if i push a button, or another need is met, it transforms one variable to the location of the other (which will be moving and empty)

thanks for your time!

What is the type of your variable, Is it Vector3?