controlling SET LINEAR VELOCITY TARGET and SET LINEAR POSITION TARGET with inputs

hi guys

I created a hydraulic cylinder using normal cylinder meshes, added a constraint and i want to use linear motors to control it, but this is where the issue lies.

so when using either the SET LINEAR VELOCITY TARGET or SET LINEAR POSITION TARGET using keys it keeps returning back to its original position when they key is released, for example i would set a value of 200 in the z axis when key is pressed and a value of 0 when released hoping that it would stay in its position it was when key is released yet it still moves back to its original starting point.

what am i doing wrong any suggestions or help with this?

and it also gets stuck when key is pressed for abit too long, i have to add radial force node in the opposite direction to get it unstuck again, ive tried clamping but i don’t see the need if i created limits in the constraint, and also i cant see how i can clamp it if I’m using inputs. any help?