I don't understand the way you're trying to do it. There shouldn't be any key presses to change direction if it's following a path.
In order to get the appropriate directional facing frame for a sprite, the movement of which is being controlled programmatically like this (path finding), you need to poll its vector.
You can do that by comparing its position last frame and this frame, if you're not using physics. If you don't have walk/run or anything like that, you can throw out the magnitude and just keep the angle, which you can convert into the frame you want.