Remove dependency on seq command

seq is not available on BSD systems by default. Switched to C-style for loop. Also created line buffer so that multiple echos are not required.