trying to implement file writing