use awk to aggregrate the field number

Hi,

I have a various files;each filled with hundreds of line with similar number of fields.

I would like to extract out field $5 from each of this file and aggregate them before printing out to a file.

I tried to :-

#!/usr/bin/awk -f

file="file1.txt file2.txt file3.txt file4.txt"

for loop in $file;
do

while((getline < "$loop"))
{
     value+=$5;
}
print $loop $value>"../" Final.txt

done;

I execute them but it gives me error:-

awk: ./loop.bash:5: for loop in $file;
awk: ./loop.bash:5: ^ syntax error
awk: ./loop.bash:6: do
awk: ./loop.bash:6: ^ syntax error

Basically, the file1.txt, file2.txt...etc.. is something like

File1.txt
foo,apple,2,3,0.02,5,6
foo,apple,2,3,5.6,5,6
foo,apple,2,3,1.23,5,6
foo,apple,2,3,4.50,5,6
foo,apple,2,3,9.20,5,6

File2.txt
foo,apple,2,3,2.00,5,6
foo,apple,2,3,5.6,5,6
foo,apple,2,3,1.3,5,6
foo,apple,2,3,4.40,5,6
foo,apple,2,3,9.10,5,6

etc..

The output i like to see is;Final.txt will have
File1.txt 20.5 #which is the sum of the $5 field in file1.txt
File2.txt 22.4 #which is the sum of the $5 field in file2.txt

I also tried to convert the above code to bash-like by using awk'{}' but its not working either.

Please advise whether what error or silly mistakes i did made in the above code.

This should work

for i in file*.txt; do awk -F',' '{a+=$5}END{print FILENAME, a >> "Final.txt"}' $i;done