generating infinitely long chain in Lammps

Please keep the list in the loop.

I don't think what you mean by an infinitely long chain is conceptually valid
for a finite size box with periodic boundaries. This is not a LAMMPS
issue, it's a conceptual issue. If you connect the ends of a chain
across the box,
it will be a ring, not an infinite chain.

Steve