Main problem in exec with echo was output redirection **">"** and pipes **"|"**. Variant with sed has similar problem :( 
As variant:
```puppet
$nameservers_str = inline_template("<% @nameservers.each do |nameserver| -%> <%= nameserver %><% end -%>"),
exec { "soa-${zone}":
  command => "$cfg_dir/puppet-scripts/zone_soa.sh $zone $soa $soa_email $zone_serial $zone_ttl $zone_refresh $zone_retry $zone_expire $zone_minimum $nameservers_str",
}
```