Line is sliced multiple times

it is necessary to slice the line only one times the size of maxDocLine
for every loop circle.