You have the path hardcoded multiple times, even though you have it in a variable called "dir" in the first line. The variable name and the comment specify it is a directory but it includes the file name. You then ask for a directory with the filename to be created.
Clean it up, then run it through the debugger to see the path used is as expected, and more importantly which line you end up with the wrong value. And read the documentation:
HttpServerUtility.MapPath(String) Method (System.Web) | Microsoft Docs[
^] - Why do you call MapPath when you already have the full file system path hard coded?
In case you consider using a debugger to be an advanced topic you will learn later, then change your priorities at once. Learning the basics of a debugger takes 10 minutes and that time is paid back within a day.