use writefile instead of extenal echo call

dash's builtin echo does not support '-e'