Your formatting is very strange!
You probably want to fix that first to make this code somewhat readable!
That said, your problem is the lack of spaces around
] are actually just shorthand for the command
You should change the first line to read as follows:
if [[ "$L1Aname" == "$filename" ]]; then
if [ "$L1Aname" = "$filename" ]; then
inside both of which examples, each character maters:
For example spaces: there need to be spaces around
Plus notice the subtle difference between
bash and POSIX in the double / single