Move to a position on buttonhold?

How Do I move an object from a position and Keep it there when I’m holding down Rightmousebutton and then reseting it’s position when the key is not pressed?

You can get right mouse button using Input.GetMouseButtonDown and Input.GetMouseButtonUp where in you use index ‘1’ to get the right mouse button input.

The psuedo-code for this will be like:

if(Input.GetMouseButtonDown(1)) {
    // Move your object to expected position
    Transform.position = expected position
if(Input.GetMouseButtonUp(1)) {
   if(Transform.position == expected position) {
        // Move your object to its original position
        Transform.position = original position