Restrict movement in unity 2d

hey guys i am new here i want my character to move only horizontal , vertical i did a code i moves well but makes character moves side ways too NEED HELP how to stop diagonal movement