If you just want to draw a [b]segment[/b], use GUI element "segment":
assign PosX,PosY to 0,0 and Size x, Size y to x,y will do it. (it should be x-xi,y-yi if the starting point is (xi,yi) instead of origin)
You can use Arrow to draw an arrow. (If you change style property of arrow, it can be turned into a segment).
There are many examples in this forum. I suggest find one you like, run it locally and open it with EJS(Right click "open EJS model") to view how it was done.