Colour line detection and tracking

I am making a product which detects line or edge of the object and tracks the coordinates. I am facing a problem if there are multiple lines in the image then I want to track the line I have teach (reference). But the script detects all the line and the subsequent flow of the script is changed.

Hi, you have to write python code which takes all the detections per image and then matches them to each other for tracking purposes. We just do single image stuff.