diff --git a/src/main/java/org/example/Course.java b/src/main/java/org/example/Course.java
index 7715ca3..ff8a721 100644
--- a/src/main/java/org/example/Course.java
+++ b/src/main/java/org/example/Course.java
@@ -105,14 +105,16 @@ public class Course {
     /**
      * Writes the information of the course to a file.
      *
-     * @param filename The name of the file to write to.
+     * @param courseName   The name of the course.
+     * @param courseCode   The code of the course.
+     * @param courseCredit The credit value of the course.
+     * @param filename     The name of the file to write to.
      */
-    public void writeToFile(String filename) {
-        try (PrintWriter writer = new PrintWriter(new FileWriter(filename))) {
+    public void writeToFile(String courseName, String courseCode, int courseCredit, String filename) {
+        try (PrintWriter writer = new PrintWriter(new FileWriter(filename, true))) {
             writer.println(courseName);
             writer.println(courseCode);
             writer.println(courseCredit);
-            // Add any other fields you want to save
         } catch (IOException e) {
             e.printStackTrace();
         }
diff --git a/src/test/java/org/example/CourseTest.java b/src/test/java/org/example/CourseTest.java
index b7c7620..01bd09d 100644
--- a/src/test/java/org/example/CourseTest.java
+++ b/src/test/java/org/example/CourseTest.java
@@ -62,7 +62,7 @@ class CourseTest {
         Course course = new Course("Math", "C101", 3);
 
         // Write course data to the temporary file
-        course.writeToFile(TEMP_FILE);
+        course.writeToFile(course.getCourseName(), course.getCourseCode(), course.getCourseCredit(), TEMP_FILE);
 
         // Read course data from the temporary file
         List<Course> courses = Course.readFromFile(TEMP_FILE);