how do i make a NPC move forward and move back?

i tried
setcharani ("walk",NULL) ;

aaand it doesnt walk but does the animation