script not working?

So when i tried out this code ( I made about 90% of it myself so of course it wouldnt work ) … it doesnt work - basicly i want my gun to move to the recoil position x and y when i press fire 1 (left click) but it wont budge…

var originalPosx = -0.1600189;
var originalPosy = -0.2532201;

var recoilPosx = -0.1597214;
var recoilPosy = -0.2532201;

var dampVelocity = 0.1;
var dampVelocity2 = 0.1;


function Update (){

  var recoilPosx = Mathf.SmoothDamp(Gun.transform.localPosition.x, recoilPosx, dampVelocity, .3);
  var recoilPosy = Mathf.SmoothDamp(Gun.transform.localPosition.y, recoilPosy, dampVelocity, .3);
  
  Gun.transform.localPosition.x = recoilPosx;
  Gun.transform.localPosition.y = recoilPosy;
  
  if (Input.GetButtonDown("Fire1")) {

        recoilPosx = -0.159721;
        recoilPosy = -0.2532063;
        
        //dont know what to do so it resets ... and goes back to its originbal position
       
        recoilPosx = -0.1600189;
        recoilPosy = -0.2532063;
 





}
}

Update will run on every frame, but before each frame is rendered.

Your lines 26 & 27, are overwriting the changes made by lines 21 & 22, before anything is drawn.

Instead you could do this:

if (Input.GetButtonDown("Fire1")) {
    recoilPosx = -0.159721;
    recoilPosy = -0.2532063;
}
else {
    recoilPosx = -0.1600189;
    recoilPosy = -0.2532063;
}

But I recommend swapping out the literal numbers and using variables you can modify using the inspector.