IfIt seems that your file1 has no trailing newline. If you want to concatenate a list of files. YoucYou can first check each one and cat a newline where needed, as follows:
# make some sample files
printf "%s\n" abc > file1
printf "%s" def > file2 # no trailing newline
printf "%s\n" abcghi > file3
printf "%s" defjkl > file4 # no trailing newline
# find files to concatenate and build a sorted array `f[]`
unset f i;
while IFS= read -r -d $'\0' path; do f[i++]="$path"
done < <(find . -type f -name 'file[0-9]' -print0 | sort -z)
# build the `cat` command
cmd=cat
tmp="$(mktemp)"; echo >$tmp # a file which contains only a `\n`
cmd=cat
for file in file1 file2 file3 file4;"${f[@]}"; do
[[ $lasthex=$(tail -c1 $file | hexdump -ve '1/1 "%02x"')
[[ -z $lasthex ]] && continue # skip enpty files
[[ $lasthex == 0a ]] && nl= || nl=" $tmp"
cmd="$cmd \"$file\"$nl"
done
# execute the `cat` command
eval "$cmd"
The concatenated result is:
abc
def
abcghi
defjkl
The generated command is:
cat "file1""./file1" "file2""./file2" /tmp/tmp.nEdFkdWgJez7iKccY0T9 "file3""./file3" "file4""./file4" /tmp/tmp.nEdFkdWgJez7iKccY0T9