Need help in shell script coding

I have a file f1.txt that contains string:

f1.txt
aaa
bbb
ccc
...

I want to write code to search that each string in file f2.txt(this file contains 1000+line codes).

file f2.txt
..
..
....aaa...xyz..
...
...
...ppp...
(dots . can be characters ot blank spaces)

If particular string 'xyz' appears in same line as the above string searched in f2.txt, i want to search the first occurence of string 'ppp' and mark it(line containing string 'ppp') in file f3.txt.

The string 'ppp' and 'xyz' will remain same for entire code, but strings in file f1.txt will vary.

awk '
NR==FNR {a[++N]=$1; next}
srch==1 && /ppp/ {print; exit}
/xyz/ {for(i=1;i<=N;i++) if ($0~a) srch=1}
' f1.txt f2.txt >f3.txt

The awk script reads f1.txt (where NR is equal to FNR) then f2.txt
It prints result line to stdout that is redirected to f3.txt by the shell.

problem solved thks for post