public static void main(String[] args) {
        Scanner lea = new Scanner(System.in);
        
        do{
            System.out.println("Direccion: ");
            String path = lea.next();
            
            if(!path.equalsIgnoreCase("exit")){
                System.out.println("Append? (s/n): ");
                char app = lea.next().charAt(0);
                
                try(FileWriter fw=new FileWriter(path,app == 's')){
                   
                   do{
                       System.out.println("Texto a escribir: ");
                       String text = lea.nextLine();
                       
                       if(!text.equals("$%&")){
                           fw.write(text+"\n");
                           fw.flush();
                           
                       }
                       else
                           break;
                   }while(true);
                   
                }
                catch(IOException e){
                    System.out.println("error: " + e.getMessage());
                }
            }
            else
                break;
   
        }while(true);
    }