There's no built-in construct to iterate over two lists at the same time. A for statement iterates over one list.
If you're using a shell with arrays, don't store lists as newline-delimited strings, use arrays insteaddon't store lists as newline-delimited strings, use arrays instead.
If oldfilenames and newfilenames are arrays, you can iterate over the array index.
for ((i=0; i<${#oldfilenames[@]}; i++)); do
x=${oldfilenames[$i]}; y=${newfilenames[$i]}; …
done
If you have to have newline-delimited strings, you can strip the first line, one line at a time.
nl='
'
oldfilenames=${oldfilenames%"$nl"}
while [ -n "$oldfilenames" ]; do
x=${oldfilenames%%"$nl"*}; y=${newfilenames%%"$nl"*}
oldfilenames=${oldfilenames#*"$nl"}; newfilenames=${newfilenames#*"$nl"};
…
done