Your mistake is that your date +"%Y%m%d%H%M" command also prints its output. You aren’t actually assigning it to a variable (which is what you seem to want/think is happening).
The correct version of what you're trying is:
# use var=$( ... ) to assign output of a command to a variable
date="$( date +"%Y%m%d%H%M" )"
echo -n $date-{query}
There’s no need for two commands, however. You can stick it all in one echo statement. And finally, you shouldn’t use {query} (it’s only there for legacy support). Use “with input as argv” instead.
In that case, your command becomes: echo -n "$( date +%Y%m%d%H%M )-$1"