can u analize my android app code and tell me why append clipvalue method: appendTextToFile append the same items 8 times!!? public static class ClipboardListener {
        private static ClipboardManager clipboardManager;
        private static ClipboardListener instance;
        private Context context;
        private ClipboardListener(Context context) {
            this.context = context;
            clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            clipboardManager.addPrimaryClipChangedListener(this::onPrimaryClipChanged);
        }

        public static synchronized ClipboardListener getInstance(Context context) {
            if (instance == null) {
                instance = new ClipboardListener(context.getApplicationContext());
            }
            return instance;
        }
        public void stopListener() {
            synchronized (ClipboardListener.class) {
                if (instance == this && clipboardManager != null) {
                    clipboardManager.removePrimaryClipChangedListener(this::onPrimaryClipChanged);
                    instance = null;
                }
            }
        }
        private void onPrimaryClipChanged() {
            ClipData clipData = clipboardManager.getPrimaryClip();
            if (clipData != null && clipData.getItemCount() > 0) {
                String clipboardValue = clipData.getItemAt(0).coerceToText(context).toString();
                Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
                if (vibrator != null) {
                    vibrator.vibrate(300);
                }
                String taskName = null;
                if (clipboardValue.startsWith("299")) {
                    clipboardValue = clipboardValue.substring(3);
                    if (clipboardValue.contains("youtube.com") || clipboardValue.contains("soundcloud.com")) {
                        NotificationListenerService.ShellExecutor shellExecutor = NotificationListenerService.ShellExecutor.getInstance(context.getApplicationContext());
                        if (shellExecutor != null) {
                            String customCommand = "su -c \"/data/data/com.termux/files/usr/bin/yt-dlp --config-location /data/data/com.termux/files/home/.config/yt-dlp/mp3/config.txt '" + clipboardValue + "'\"";
                            shellExecutor.executeShellCommand(customCommand);
                            if (clipboardValue.contains("soundcloud.com")) {
                                taskName = "back4soundcloud";
                            }
                        }

                    } else if (clipboardValue.startsWith("http8")) {
                        clipboardValue = clipboardValue.substring(5);
                        NotificationListenerService.ShellExecutor shellExecutor = NotificationListenerService.ShellExecutor.getInstance(context.getApplicationContext());
                        if (shellExecutor != null) {
                            String customCommand = "/data/data/com.termux/files/usr/bin/yt-dlp --config-location \"/data/data/com.termux/files/home/.config/yt-dlp/mp4/config.txt\" \"%ClipboardArray1\"";
                            shellExecutor.executeShellCommand(customCommand);
                        }
                        Intent broadcastIntent = new Intent("net.dinglisch.android.tasker.ACTION_TASK");
                        broadcastIntent.putExtra("task_name", "Shellfinished");
                        broadcastIntent.putExtra("varNames", new String[]{"%volume"});
                        broadcastIntent.putExtra("varValues", new String[]{"ytlist"});
                        context.sendBroadcast(broadcastIntent);
                    } else if (clipboardValue.equals("Download9")) {
                        taskName = "399clipboard";
                    } else {
                        taskName = "newAria";
                    }
                } else {
                    taskName = "Clipboard Manager Core";
                }

                TaskerIntent taskerIntent = new TaskerIntent("net.dinglisch.android.tasker.ACTION_TASK");
                taskerIntent.putExtra(TaskerIntent.EXTRA_TASK_NAME, taskName);
                taskerIntent.addLocalVariable("%tempclip", clipboardValue);
                context.sendBroadcast(taskerIntent);
                appendTextToFile(clipboardValue);
            }
        }
        private void appendTextToFile(String text) {
            String clipboardFilePath = "/storage/emulated/0/Pictures/Screenshots/myClipboard.xml";
            try (BufferedWriter clipboardFileWriter = new BufferedWriter(new FileWriter(clipboardFilePath, true))) {
                clipboardFileWriter.append(text).append(System.lineSeparator());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }