Avoid using a while loop here, it will be a disaster. There's also no real need to keep the words in a txt file, though that's more of a preference thing.. I'd prefer to just use a variable for the words and have it in the code itself

You can use the isin operator

Code:
var %sentence = the man on the moon
if (man isin %sentence) { echo -a true }


But it's not optimal. It doesn't care about word boundaries, so it will also match on "manfield" in the above example.

What you really need is a regular expression. RegEx is somewhat complicated, but also extremely useful. In the code below is an example of the regex pattern you'll need

Code:
alias test {
  var %words = potatoes|banana man|haumph|rawr|etc 
  var %sentence = I am the Banana Man and I like potatoes. Haumph ! 
  echo -a $regex(%sentence,/\b( $+ %words $+ )\b/gi) matches  
}