How to make a loop work?

Hi all! Please, help me. I do not know how to do it.

I have many files with different structures.

The file processing algorithm depends on the file structure.

How to make a loop work? Thanks all!