Your code did actualy work...for the minutest part of a second !... the screen was updated but then it got to the 'wait key' part and then waited...
when you have sync on you need to constantly update the screen, so your code would become.
sync on : sync rate 60
ink rgb(255,255,255),rgb(0,0,0)
box 0,0,600,400
Repeat
sync
Until scancode()>0
*edit*
in case you didnt know 'scancode()' returns the value of a key pressed on the keyboard..for a list of the keys see the attachment to this post.
So until you press something the 'scancode()' returns nothing, then when you press a key it returns a number, which is greater than zero so the loop ends.
Did that help ?