http://alignedleft.com/tutorials/d3/an-svg-primer
It's hard to know what's going on without seeing the rest of your code, but one question: Where are you appending the line? Normally you begin with a select statement, like:
d3.select("svg").append("line")
.attr("x1", x1)
…
…or store a reference to a selection, and start with that:
var svg = d3.select("svg");
svg.append("line")
Either way, d3.svg.append("line") doesn't really make sense. I think you may be conflating selection.append() and d3.svg.line, which creates a line generator function, see:
Scott