You misunderstand how SetAnimation
works. You call it once when you want an animation to play, like you do for the key pressed event, which is only invoked once when the D key goes down. Depending in the loop parameter, the animation is then either played once, or forever, until you set a new animation.
In your second sub-graph, you are calling SetAnimation on every tick if the velocity is greater than 0. You are setting the animation over and over again, which, together with the default mix and the loop parameter, results in the weird behaviour you see.
You need to set the animation the first time the velocity is > 0, and set and empty animation (or a different animation) when the velocity is <= 0.