You can read from files in TeX. Presume you have a file
foo with content
(0,0) -- (2,0) -- (2,2) Then you can read that line and pass it to a draw command as follows:
And that will draw the corresponding lines. If you have multiple lines in a file then
\read\bar to \res a second time will read the second line from the file. After you are done with it, you should
\closein\bar. There is also an
\ifeof which you can use to loop over the file until it contains no more lines.
To go through the entire file, you can simply write a macro that loops as long as there are things to read. For this simple setup to work, the first command in the loop has to be the read of the file.
This will add every line of the file to the same