Nothing special, repeat loop repeats lines inside loop as many times as specified after repeat statement... Note that number specified for repeat function must be an integer, not floating number, or list, or string...
As for your posted code, I have one small remark...
change
(acet-lwpline-remove-duplicate-pnts (ssname sel (setq n (1- n)))))
to this
(acet-lwpline-remove-duplicate-pnts (entget (ssname sel (setq n (1- n))))))
M.R.