Say you have a terrain with an ID of 101.
Then in the main loop,
// Get the 3D coords of the clicked area on the terrain
dbPickObject(dbMouseX(), dbMouseY(), 101, 101);
x = dbCameraPositionX() + dbGetPickVectorX();
y = dbCameraPositionY() + dbGetPickVectorY();
z = dbCameraPositionZ() + dbGetPickVectorZ();
Then later you can simply use the x, y, and z
// Place the flag to mark the targeted area. IE, represented by a cube with an ID of 1000.
if(!dbObjectExist(1000))
dbMakeObjectCube(1000, 1.0f);
dbPositionObject(1000, x, y, z);