Script doesn't work eveytime

Hello, I’ve got a problem with this following script, my aim is to stock data in a txt file, when I try to store the data from an eye tracker (lines in comments) it works instead that the others lines do not appears and that the name of the txt file is the one that I’ve used before changing my script so I find it very weird because the name of my txt file is the old one and not the new one. But when I try the script without trying to store data from an eye tracker, nothing is record and the txt file is not creates.

using UnityEngine;
using System.Text;
using System;
using System.Collections.Generic;
using UnityEngine.UI;
using System.IO;
using System.Linq;
//using Newtonsoft.Json;
//using TETCSharpClient;
//using TETCSharpClient.Data;


public class Enregistrements : MonoBehaviour{

    //    public string folder =  "Enregistrements";
       

    //public static void essai (GazeData gazeData)
    public static void trial()
    {
        using (StreamWriter sw = new StreamWriter ("test.txt"))
        {
            sw.WriteLine("Coordinates in X" + ";" + "Coordinates in y");
            //sw.WriteLine ( gazeData.SmoothedCoordinates.X + ":" + gazeData.SmoothedCoordinates.Y + ":" + Time.time);
            sw.WriteLine(Time.time);
        }
    }
}

Did someone have an idea of how the problem can be solved ?
Thanks vey much

I have hardly understood a word from what you were saying in the above text paragraph. Do you want to express that the file always contains just two lines of text and is not storing the previously written lines? Thats because you are recreating the file everytime you call trial().

using (var sw = new StreamWriter("test.txt", true))
{
   // ...
}

This constructor-overload contains a second parameter called append, which defines if written lines should be appended instead written into a newly created text file.

Thanks for reply but it wasn’t my problem. Mine is that before doing that script I’ve used another one which made the same thing with differents names. I deleted it an create this new one, but the problem is that my txt file have the name of what I’ve defined in the first script (the one I’ve deleted). So I was wondering why I’ve got this problem, I’ve checked in all the computer to see if there’s no presence of my first script and there’s not.

Thnaks so much