Sorry but I can't see anything directly, immediately, wrong with your code as such.
Some "style" comments: This is not WRONG as such, but...
change code like this
to something like this:
(Obviously likewise for the cursor up code)
That way, the increment/decrement is much more obvious, and if you ever change write_cursor to be a macro or some such, it won't affect the update of the actual position. It also helps if you ever try to debug the code - you can check the value before you call the function, rather than having the function call and increment as one line which you can't (triivally) separate into different steps.
Following that a step further, you can do:
This would make smaller code, and easier to follow/debug/understand.
oldCursorY = cursorY;
... check if cursor key pressed; update cursorY....
if (oldCursorY != cursorY)