The syntax for that would be something like
printf '%s\n' "$string1" "$string2" | ./script2.sh filename"$i"
You could also use a here document:
./script2.sh filename"$i" <<____HERE
$string1
$string2
____HERE
Some people will tell you echo but it has various portability issues etc; printf is uniformly standard and safer. But if it's just two static lines of string, you can certainly do
echo 'string1
string2' | ./script2.sh filename "$i"
(yes, that is a single-quoted string with a newline in the middle) or somewhat less efficiently
( echo string1; echo string2 ) | ./script2.sh filename"$i"
The general syntax of a pipeline is command1 | command2 | command... so what you had would not work unless string1 was a command which produced the desired output. (This is not impossible to do, but probably not a good idea in this particular scenario.) But on top of that, you were piping the output from the script to string1 where you clearly want vice versa.
Any command which produces suitable output can be used to feed the pipeline; if you need lots of input, try yes, which exists specifically for this purpose;
yes string1 | head -n 2 | ./script2.sh filename"$i"
Here, yes prints an endless sequence of string1 lines (well, it ends when the pipeline is closed by head); head passes through just the first two.
|for?script2.shread two lines from standard input? Does it assume particular variables will be present in its environment?#!/bin/bashit opens up a lot of possibilities for different approaches (at the cost of portability). If you intend this to be a shell script, you should remove the word "bash" from your question and tags. Otherwise, you should change the shebang.