How would I go about making something move to a position over time?

The idea is while holding down Space, an X will appear in front of the character, and the longer you hold it down the further the X will move away. If you let go of Space, it will dissapear. How would I make something happen over time? Any ideas? Thanks in advance!

This is a great tutorial which is close to what you are looking for - Modulating values with Lerp - Unity Official Tutorials - YouTube

It even has inputs, you can have the game object destroy itself when the key is let go.