
For example, there is a file "/home/artem/IP" with IP addresses on which you want to execute a remote command, the FOR loop will look like this:
IP="$(cat /home/artem/IP)"
for i in $IP
do
    ssh root@$i 'hostname'
done

For example, there is a file "/home/artem/IP" with IP addresses on which you want to execute a remote command, the FOR loop will look like this:
IP="$(cat /home/artem/IP)"
for i in $IP
do
    ssh root@$i 'hostname'
done