replaced echo >> with sed