OnMouseOver get cursor position on object

I have a camera that’s tilted downwards a little and looking at a terrain. I want to make a OnMouseOver script for the terrain. When the mouse moves over the terrain, it gets the position of the mouse over the terrain. Then it moves a waypoint to the mouse position on the terrain. This is not on mouse click, I want the waypoint to continuously follow the mouse as long as it’s over the terrain.

how would I do this?

See http://unity3d.com/support/documentation/ScriptReference/Collider.Raycast.html

for example code. You would detect the hit point with raycast, and detect that the mouse is clicked, then instantiate (or move) a waypoint object to that position.