A "Selection" is a collection of entities (lines, faces, etc.)
In order to get the line, you have to get the first object in the Selection, since you only have one thing selected:
line = selection[0]
Then, once you have the line, you can get the start and end vertices like this:
vtxStart = line.start vtxEnd = line.end
To get the positions of the vertices, just type either: startPosition = vtxStart.position or endPosition = vtxEnd.position
Hopefully this is clear enough to get you started.