Fix line number indexes

We need to increment line numbers after we've added each line to avoid an off-by-one error.