Hi,
Ah, this is an interesting example of how sometimes things that look obvious don't quite behave as you might intuitively expect. This is happening due to the use of ssh within your loop, as per the earlier replies you received. To understand why it's happening, however, let's look at some examples that demonstrate what's going on.
So, let's imagine we have a file that contains the numbers 1 through 10, one per line, and we have a loop that reads through them, prints out the loop number, and then runs an SSH command within that loop. Here's what we get, in that circumstance:
$ cat sshtest.txt
1
2
3
4
5
6
7
8
9
10
$ while read number; do echo Loop pass: "$number"; ssh localhost "sleep 1"; done < sshtest.txt
Loop pass: 1
$
So, as you can see, we get exactly what you describe - rather than seeing 10 passes through this loop, we only see the first one, despite our SSH command being about as simple as it gets (log in and run sleep 1 to wait one second).
Now, why is that happening ? It's happening because the SSH client is reading in standard input from the loop, and so ends up effectively "stealing" the rest of your read data. We can demonstrate that as follows:
$ while read number; do echo Loop pass: "$number"; ssh localhost "echo The folowing output comes from the SSH connection: ; cat -"; done < sshtest.txt
Loop pass: 1
The folowing output comes from the SSH connection:
2
3
4
5
6
7
8
9
10
$
Here, we can see what happened to numbers 2 through 10 - they were passed to ssh as its input, and if we then print that output with a cat - command (which basically will print out whatever has been passed to it as its standard output), there's the rest of the numbers we read in.
Now, how to prevent this ? Well, there's a few ways, but one method would be to read all our numbers in ahead of time using a for loop, thusly:
$ for number in $(cat sshtest.txt); do echo Loop pass: "$number"; ssh localhost "echo Here is the output from SSH"; done
Loop pass: 1
Here is the output from SSH
Loop pass: 2
Here is the output from SSH
Loop pass: 3
Here is the output from SSH
Loop pass: 4
Here is the output from SSH
Loop pass: 5
Here is the output from SSH
Loop pass: 6
Here is the output from SSH
Loop pass: 7
Here is the output from SSH
Loop pass: 8
Here is the output from SSH
Loop pass: 9
Here is the output from SSH
Loop pass: 10
Here is the output from SSH
$
Here, we use command substitution (the meaning of that $(...) syntax) to run the command cat sshtest.txt, capture its output, and assign it to the variable $number. We then have all our input read in and ready for use before we do anything else, and that allows us to use SSH in a loop in the manner that is likely expected.
Oh, and lastly: in the future, could you please post code excerpts and output as actual raw text appropriately bounded with markdown or tags, rather than posting screenshots ? Again, this makes it easier for others to read what you have posted, and avoids needlessly using attachments when you don't have to. It's also more accessibility-friendly, as it would mean that users using screen reader software would be able to hear what you posted, whereas a JPEG or PNG isn't something they'd have any straightforward way of obtaining the content of.
Hope this helps !