Moving object

Could somebody tell me how to move object? MOVE, not teleport. I want my object to change “localPosition.z” from 4 to -4 in 1 second for example. I was trying to do that but i have no idea. I want this as function.

Use an Animator. You can put then a first key in which localPosition.z is 4 and another key 1 second later in which it is -4, and the intermediary values will be calculated by Unity on the fly.

You need to understand how Animators works, though.