private void writeToFile(String strRep, String path) {
        FileOutputStream fos = null;
        File file;

        try {
            //Get all current text into temp
            String temp = "";
            Scanner sc = new Scanner(new File(path));
            while(sc.hasNextLine()) {
                temp += sc.nextLine() + '\n';
            }
            sc.close();

            file = new File(path);
            fos = new FileOutputStream(file);

            //Todo new file creation
            // if file does not exists, then create it
            if (!file.exists()) {
                file.createNewFile();
            }

            // get the content in bytes
            temp = temp + strRep;
            byte[] contentInBytes = temp.getBytes();

            fos.write(contentInBytes);
            fos.flush();
            fos.close();

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fos != null) {
                    fos.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }