The character walks to the edge of the map and starts to shake wildly

Hi

Sorry for the late reply.

Your movement script has a moveDir which is a normalized direction. If the agent is very close to the end of the path the direction to the next point will be veeery small. If you normalize it while the agent moves around slightly it may change direction and point in the completely opposite way. This will lead to shaking. The built-in movement scripts reduce shaking by disabling rotation if the agent is very close to the waypoint.