Record a specific movement of a gameObject, then save it as an animation in Unity?

How can I record a specific movement of a gameObject, then save it as an animation in Unity?

Use the animation editor.

You can look for the section called Animating a Game Object