I see you're trying to get both the direction and the pixel count from the spoken phrase, but you're comparing that phrase to literal string for the direction.
If you're speaking something like "up 15", comparing "{CMD}" to "up" will return false, as "up 15" is not the same string as "up".
You'll want to use "Contains" instead of "Equals".
There are a few other alteration you could make, though they're not required for the command to function correctly:
Set Text [direction] to '{CMD}'
Move mouse cursor to Active Window Screen Center
Hold left mouse button down
Set integer [loop] value to the converted value of {TXTNUM:"{CMD}"}
Begin Text Compare : [direction] Contains 'up'
Start Loop : Repeat [loop] Times
Move mouse up [1] pixel(s) (from cursor position)
End Loop
Else If Text Compare : [direction] Contains 'down'
Start Loop : Repeat [loop] Times
Move mouse down [1] pixel(s) (from cursor position)
End Loop
Else If Text Compare : [direction] Contains 'left'
Start Loop : Repeat [loop] Times
Move mouse left [1] pixel(s) (from cursor position)
End Loop
Else If Text Compare : [direction] Contains 'right'
Start Loop : Repeat [loop] Times
Move mouse right [1] pixel(s) (from cursor position)
End Loop
End Condition
Release left mouse button
The non-unique actions have been moved outside the conditional blocks so they're not duplicated(you could do the direction check inside the loop as well and do away with the multiple start and end loops, but in theory it is more efficient not to do the check each time the loop comes around).
The "{TXTNUM:}" token is now passed the "{CMD}" token directly, without an intermediate variable(tokens are processed and replaced by literal text, so you can use double quotes to indicate "{TXTNUM:}" should treat the input as such, rather than looking for an integer variable with that name).
You could also use "{CMD}" directly in the text compares, which is arguably more readable, but it is theoretically more efficient to only parse the token once and read from a variable instead.
The while loops have been replaced by for loops(which will do the counting for you, instead of having to manually decrement the variable).
I also notice you're not using relative units for mouse movement(as the application doesn't need them); Have you tried moving the cursor the desired amount of pixels directly, rather than one pixel at a time?
That doesn't work in some applications, but it's worth trying as it should be quicker.