Add func for write to file