I am trying to get my legend to work. It says that x and y are different lengths. However, my code works with everything but the legend. Here is where it stops working. Please help.

Here is the first part of my code:

CI <- predict(out, se.fit=TRUE)

W <- sqrt(2*qf(0.95,length(out$coefficients), out$df.residual))

Band <- cbind(CI$fit - W * CI$se.fit, CI$fit + W * CI$se.fit )

Here is the second part of my code:

points(sort(data$ACT), sort(Band[,1]), type="l", lty=1, col="springgreen4", lwd=3)

points(sort(data$ACT), sort(Band[,2]), type="l", lty=1, col="springgreen4", lwd=3)

legend("topleft", legend=c("Mean Line (-----)", "95% CB (red1)",

"95% Prediction (deepskyblue)", "WH (springgreen4)"), col=c(1,1))