From the looks of it you simply want to create your text file in a custom directory. My advice would be to create a constant for the path (perhaps saving it in the app.config file).
<appSettings>
<add key="UserInfo" value="/Settings/UserInfo.txt" />
</appSettings>
Use a relative path to your exe so regardless of where you install your application the settings will always be saved to "PathToExe/Settings/UserInfo.txt".
Then you would do something like:
string UserInfoPath = ConfigurationManager.AppSettings["UserInfo"];
if (String.IsNullOrEmpty(UserInfoPath))
{
// perhaps use a default value or raise an exception
}
FileInfo fileusername = new FileInfo(Path.Combine(Application.StartUpPath, UserInfoPath));
StreamWriter namewriter = fileusername.CreateText();
namewriter.Write(txtUsername.Text);
namewriter.Close();
However, you may come across a permissions issues using this approach, it is usually a better idea to store things like this either in the Registry or in the AppData directory.