Making a infinite world for a game

I am making a game where a spaceship needs to dodge objects but i need my world infinitly generate (only the walls need to infinitly generate in the same row of walls)
can someone please help me with that?

Here you have how to repeat something that would be more or less bg