HTML5 Canvas Tutorial4 - Lines
Methods
beginPath():begins a path
moveTo(x,y):moves the pen to the coordinates specified by x and y
lineTo(x,y):draws a line from the current drawing position to the position specified by x and y
stroke():draws the path on the canvas
Demo
Try this code