Keep Player Moving in Straight Line

I am trying to make a game to learn code. I am new to unity and my question is how would I keep an object (a bird) flying in a straight line and you can change its height with arrow keys. I would like it to be smooth. By the way it is 2D sort of like a platformer with no floor and gravity. Thank You

So it’s 2D right?

using System.Collections;
using UnityEngine;

public class BirdMovement : MonoBehaviour {

//Requires a Rigidbody2D on the bird...

     public float Speed = 5.5f;  
     [SerializeField]
     private float riseSpeed = 4.5f;

    void FixedUpdate()
    {
        GetComponent<Rigidbody2D>().velocity = new Vector2(Speed, 0);
        riseSpeed = Input.GetAxis("Vertical");
        GetComponent<Rigidbody2D>().velocity = new Vector2(0, riseSpeed * Speed);
    }
}