This loop overwrites the existing line every time. It sounds like you have many lines. You will need to construct a vtkPolyData of lines instead.
The vtkPolyData has a set of points and cells (connectivity). You can construct vtkPoints and a vtkCellArray, give them to a vtkPolyData. Then write that vtkPolyData to a file.
Here is an example with the construction of a cube:
https://kitware.github.io/vtk-examples/site/Python/GeometricObjects/Cube/
In this example the pts is set to sets of quads (counter clockwise connectivity of 4 points). You will need sets of lines so yours would look more like:
pts = [(0, 1), (4, 5), (0, 1), (1, 2), (2, 3), (3, 0), ...]
This is just some fictitious example of connectivity.