Hello,
There are a few things to consider, first of all the hardware. If you are not getting straight lines, then either your tool is wobbly or your mastering is wrong.
On the software side, the C_DIS settings are crucial. You can set the $apo.cdis variable either from Display/Variable/Single (in Expert user group) or in the KUKA|prc settings.
It blends movement, the unit is mm. So if blending is enabled for a movement (default in KUKA|prc, you can change it by right-clicking the icon of e.g. a LIN movement) it will smooth movements. For drawing that means that the pen doesn't lift of vertically, but when it's x mm (the value of $apo.cdis) away from the lift-off, it will blend the movement and move diagonally up. Then again if you have $apo.cdis set to 0, or disabled the C_DIS option for a movement, the robot will stop at every position, which also isn't ideal.
For proper drawing you can try to disable C_DIS for the first and last position, and set $apo.cdis to a value that allows you to get sufficient accuracy, while also ensuring a smooth movement of the robot.
Sorting and joining of curves is something you need to implement in Grasshopper, KUKA|prc will not reorder your toolpaths by itself, as that could cause serious issues.
Best,
Johannes