Telnet and redirection of stream

Here is my command:

t.cmd(‘String’ => “echo -e ‘#{buffer}’ > #{data[‘cfgwlan’]}.tmp”,
‘Timeout’ => 10, ‘Match’ => “#{data[‘match’]}”)

t - telnet object (used several times in my code)
#{buffer} - is string to redirect
#{data[‘cfgwlan’]}.tmp - file path/name
#{data[‘match’]} - prompt (is ok because I use it several more times in
my code)

The problem is that the command always ends on timeout. What is wrong
with it. Any other command executed exactly with the same way ends ok
with matching prompt.

Any help will be helpful.