Answer:
Check the explanation
Explanation:
using System;
using System.IO;
                  
public class Program
{
  
   public static void Main()
   {
       string[] lines;
       Console.WriteLine("enter name of the file");
       String fileName=Console.ReadLine();
      
       Console.WriteLine("enter path of the file");
       String filePath=Console.ReadLine();
      
       using (StreamReader streamReader = File.OpenText(filePath))
       {
           String text = streamReader.ReadToEnd();
           lines = File.ReadAllLines(filePath);
       }
       Console.WriteLine("Enter path of the file to write");
       String outputFilePath = Console.ReadLine();
       bool fileExist = File.Exists(outputFilePath);
       if (fileExist)
       {      
                   overWriteOrChangeFileName(outputFilePath);          
       }
       else
       {
           File.Create(outputFilePath);
           File.WriteAllLines(outputFilePath, lines);
       }
       Console.Write("Input file Path"+filePath);
       Console.Write("output file path"+outputFilePath);
      
       void overWriteOrChangeFileName(String filePathtoCheck){
           Console.WriteLine("File exists. Do you want to overwrite the file or do you want to change the location and file name of the new file.Press Y to overwrite and press C to change the location and filename");
           String userInput=Console.ReadLine();
           if(userInput.Equals("Y")){
File.WriteAllLines(outputFilePath, lines);
           }else{
               Console.WriteLine("enter new path of the file including filename");
               String NewFileName=Console.ReadLine();
               outputFilePath=NewFileName;
               if(File.Exists(outputFilePath)){
                   overWriteOrChangeFileName(outputFilePath);                  
               }
               else
       {
           File.Create(outputFilePath);
           File.WriteAllLines(outputFilePath, lines);
       }
           }
       }
   }
  
}