Bizarre failure of shell script 'diff'

I need to do some more testing, but haven't had the time. My suspicion is it's something about the two $KMVAR values I'm passing in—they're both multi-row entries, so maybe that's (somehow??) throwing something off. But if so, I wouldn't expect any version of what I'm trying to do would work, yet it does with the extra line (or the echo redirect).

-rob.