create a file in the directory of the exe and write to it c#

C#
string GuarnteedWritePath = System.Environment.
                             GetFolderPath(
                                 Environment.SpecialFolder.CommonApplicationData
                             );
            string FilePath = Path.Combine(GuarnteedWritePath, "LogFile.txt");
Source

Also in C#: