Ciao,
Mancavano soltanto il beginPath(); ed il closePath();

Saluti

//horiz. line
ctx.beginPath();
ctx.moveTo(0,yPos);
ctx.lineTo(WIDTH,yPos);
//vert. line
ctx.moveTo(xPos,0);
ctx.lineTo(xPos,HEIGHT);
ctx.closePath();