Basic 2D Movement

I have Unity 5.6 and im kinda new, i saw a lot of videos and scripts, but after a lot of time i cant find a working one, ive tried a lot of ways some basic movement, like moving Horizontally and Vertically so i can learn some things. Im trying to make a ship that W makes it go forward and A and D make it rotate ^^
C#

public float moveSpeed;

void update{
 if (Input.GetKey(KeyCode.D))
        {
GetComponent<Rigidbody2D>().velocity = new Vector2(moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
}
 if (Input.GetKey(KeyCode.A))
        {
GetComponent<Rigidbody2D>().velocity = new Vector2(- moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
}

}

it’s very basic but should get the job done

create a script, attach to player and set the value of movespeed in inspector``

I know this question is little bit old now but i recently created a simple way to move your character left and right. Hope it helps anyone finding this!