Under what shell? If this works as described, then it's broke.
"GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)"
"grep (GNU grep) 2.20"
So where $data is a newline delimited list of items/patterns:
grep "${data}"
..will indeed match each item/pattern individually and grep over each, eg, just as grep -f does against a file with a list of patterns. It doesn't work without the double quotes, and putting the echo in front was obvious derp in hindsight. See my comment where I replied to uraza and demonstrated this.