There should be plenty of examples online if you go searching, other than that it is as simple as a staggered if statement, you have 2 spaced sensors and your on a line with only 1 sensor getting a reading, if the second sensor sees the line it is curving one way, if the first sensor looses it without the second picking anything its either end of line or curving the other direction
(a basic test like this is why so many spin in one direction when they loose the line)