Implement Do While loop and find line algorithm