walk animimatioin

i made a walk animation but when i walk(press W)
it goes up and down, but i can walk to another place.
I think because i used loc.
so i deleted de x and y lines.
But now my charectar isnt dynamic when walk up a hill it goes right though it.

Anyone al solution?