wrote a method to draw lines on a canvas