To get a vertical line you use the a simple 2 element vector where x does not change(to make a horizontal line simply make the y constant) such as;
plot([xConstant, xConstant], [yStart, yEnd])
So for that first green line in the image above that goes from (-1, -1) to (-1,0) it would look like this;
plot([-1, -1], [-1 0])
now to add this into a for loop you could do the following, which will create the lines you request;
for ii = 1:length(td)
plot([td(ii), td(ii)], [yd(ii), y(ii)])
end