write to local file, create if non-existent