This demo might help. Add a line to the geogebra object and then manipulate it, changing color of the two points, moving the points around, getting the value of the points.
https://demo.webwork.rochester.edu/webwork2/2017_UR_WW_workshop/geogebra/6
If you haven't seen it before you should look at the Geogebra website defining it's javaScript API. It's quite extensive and the documentation is good.
https://wiki.geogebra.org/en/Scripting
Hope this helps.
-- Mike