Trying to compare lines in 2 files

Hello, I am new to scripting and need some help. In looking at other posts on this forum, I came up with the following logic. I cannot figure out why I am getting names of files of the current directory in my echo output.

Scenario: message file has a line containing the version. Version.txt contains the correct version. I have to see if the message file's version matches the correct version.

Can you tell me what I am doing wrong??

cat /home/brdholman/testing/Tar/Message.dat | while read LINE
do
#if [[ "$LINE" = "$Version.txt" ]]
VERSION="$LINE"
cat Version.txt | while read LINE2
do
if [[ "$LINE2" = "$VERSION" ]]
then
echo $VERSION
else
continue
#echo not equal
fi
done
done

Try simplifying to this..

#!/bin/sh

cat /home/brdholman/testing/Tar/Message.dat | while read LINE
do
     VERSION="$LINE"
     cat Version.txt | while read LINE2
     do
          if test "$LINE2" = "$VERSION"
          then
              echo "$VERSION"
          fi
     done
done

I don't think the "continue" adds anything positive.

No, the continue doesn't. I was using it as a place holder. Thanks.