add write to file feature.