se ogni volta riscrivi TUTTO il file, basta aprirlo in OUTPUT anziché in APPEND