I suggest you match content in the xml files, and print out those lines, instead of looking for the 8th line.
This command will dump all lines containing STUFF from all xml files into one new file called new_file.txt.
Code:
grep 'STUFF' *.xml > new_file.txt
BTW, if you really want the 8th lines, you can get them with something like:
Code:
find . -name '*.xml' -exec sed -n '8p' {} \; > new_file.txt
That said, to the point of your original question: your for loop is also malformed. The bash manual says:
Code:
for name [ [ in [ word ... ] ] ; ] do list ; done
There, from a documentation standpoint, the [ means "this clause is optional". If you use a [ in a script, it means to start evaluating a conditional expression.