"I walk 50 meters north."
I would have used へ with directions but it is not wrong using に (think of the two are generally interchangeable)
へ is more vague and means "going towards" or "in that direction" rather than actually arriving at the destination.
That just makes へ seem even more fitting - you go towards north, you don't arrive at north
Particles are appended after various words or clauses to indicate various meanings, instead of prepended to a verb or clause (which is how prepositions work in English).
北に歩きます - に is a particle appended to 北 to mark it as the destination for the verb 歩く.