OK, let's tackle this step by step.
First, don't start by attacking the loop. That's just a simplification so that you don't have each and every file manually. Instead, develop the necessary steps using 1 file as example, in a way that can be applied to all other files.
The first thing you want to do with each file is remove the first 2 lines, and the last one. This can easily be done using man sed (POSIX):
sed -e '1,2d; $d' file
Next, you want to remove all empty lines. This can be included with the previous sed statement:
sed -e '1,2d; $d; /^[:space:]*$/d' file
Once that's done you want to surround the values with and SQL INSERT statement. For that, we need a second sed statement:
sed -e '1,2d; $d; /^[:space:]*$/d' file | \
sed -e '1s/^/INSERT INTO file VALUES (/; $!s/$/,/; $s/$/);/'
This can be read as "On the first line, replace the beginning of the line with this string. On all but the last line, replace the end of the line with a comma. On the last line, append the string to the end of the line."
Now that a single file can be processed as needed, we can start working on the loop. A simple for loop is all that is needed:
for file in /xxx/sss/*
do
sed -e '1,2d; $d; /^[:space:]*$/d' ${file} | \
sed -e '1s/^/INSERT INTO file VALUES (/; $!s/$/,/; $s/$/);/'
done
But wait! The table used should be the one the file is named after, so we'll have to use that somewhere too. For that we need man basename (POSIX), and we have to alter the second sed statement a bit (marked in green)
for file in /xxx/sss/*
do
filename=$( basename $file )
sed -e '1,2d; $d; /^[:space:]*$/d' ${file} | \
sed -e '1s/^/INSERT INTO '${filename}' VALUES (/; $!s/$/,/; $s/$/);/'
done
That's all there is to it. There's no magic, arcane knowledge, or infinite UNIX wisdom needed as long as you can break down the steps as far as needed, and are not afraid of reading the man pages for the commands you think you'll need.