Here's what I think is going on :
I first wanted to put a linear interpolation and then check the time to send it back to it's original position.
Since the final value is in an if statement, it recalculates the value every frame, so a simple linear doesn't work.
I then noticed that it was tacking the last value of the linear interpolation in account.
So I modified that final destination value to "fit" the animation...