You're putting the csv into the Response. The Response is what is sent back to the user.
All you have to do is use the File object,
File Class (System.IO)[
^]. It's very easy. Build up your csv in a StringBuilder and then use File.WriteAllText().
The biggest problem here is the account running the app pool in IIS is the account your code will execute as. That account will need write permissions to the network share.