I am trying to understand local/environment variables and export/set commands.
$ set FILEM="razrax"
$ echo $FILEM
$ FILEN="test"
$ echo $FILEN
test
Please explain why echo $FILEM returns empty string
You're confusing bash with csh.
In bash like in any Bourne-like shell, set is the command to set options (shell configuration settings like -f, -C, -o noclobber...) and positional parameters ($1, $2...).
set FILEM="razrax"
Sets $1 to FILEM=razrax.
$ set FILEM="razrax"
$ echo "$1"
FILEM=razrax
The syntax for variable assignment in Bourne-like shells is:
VAR=value
(no space allowed on either side of =).
ksh and some other Bourne-like shells (mksh, pdksh, zsh) can also assign array variables with set though:
set -A array value1 value2
zsh, bash, yash and newer versions of ksh use this syntax instead:
array=(value1 value2)
In contrast, in csh or tcsh, the syntax is:
set VAR = value
set array = (value1 value2)
(spaces around = optional).
In rc/es shells:
VAR = value
array = (value1 value2)
(spaces around = optional).
set -C sets the -C option (same as set -o noclobber). set foo assigns foo to $1 (and $# is 1, ($2, $3 are unset if previously set)). Check your shell's manual for details.