add write external file method