If you construct a matrix of points, you can use apply to plot the lines like this:
Create a matrix of coordinates:
cbind(x,x,y,predict(ols))
# x x y
#1 12 12 2 3.450920
#2 21 21 7 5.153374
#3 54 54 11 11.395706
This can be plotted as:
apply(cbind(x,x,y,predict(ols)),1,function(coords){lines(coords[1:2],coords[3:4])})
effectively a for
loop running over the rows of the matrix and plotting one line for each row.