All variables are used in the code. Objects are ordered in a hierarchial manner, which means that in order to access a particular object you often need to query several objects.
At the first line, the parent of all objects within AutoCAD is accessed; it's the application itself. The next line queries the application object in order to retrieve the active document. This object is always present as a child of the application but is assigned on the fly to point to the active document. It corresponds to the ThisDrawing object in VBA.
As the purpose of the routine is to draw a line, it needs to access a drawing area where a line can be drawn. A document object holds a number of child objects in itself, one of which is the modelspace drawing area. Of course, it's not literally an "area" but simply a collection of graphical objects such as lines and circles etc. So before a line can be added, the routine needs to query the active document to get hold of the modelspace object.
Except for the very first function that retrieves the application, notice that the queried object is always given as the first argument to a VLA function.
The 4th object is one that gives access to user interface functions. They are (typically) ActiveX equivalents to those we know as GETxxx functions in AutoLISP. Notice the first argument in VLA-GET-UTILITY. It means that the Utility object is a child of the application.
The whole thing could schematically look like this:
AutoCAD application --> Utilities object (to get points etc.)
| |
v vla-getPoint pt1
Active document vla-getPoint pt2
| |
v v
Modelspace --> vla-addLine Modelspace pt1 pt2
|
v
Line object