/**
 * This function appends new elements to an existing file.
 *
 * @param filename The name of the file to append the elements to.
 * @param elements A list of elements to append.
 */
import java.io.File


fun appendElements(filename: String, elements: List<String>) {

    // Opening the file in append mode
    File(filename).appendText("\n")
    File(filename).bufferedWriter().use { writer ->
        // iterating over the elements
        for (element in elements) {
            // checking if the element is already present in the file
            if (File(filename).readText().contains(element)) {
                println("$element already exists in the file.")
            } else {
                // checking if the element starts with a vowel or a consonant
                if (element[0].toLowerCase() in listOf('a', 'e', 'i', 'o', 'u')) {
                    writer.write("$element is an element starting with a vowel.\n")
                } else {
                    writer.write("$element is an element starting with a consonant.\n")
                }
            }
        }
    }
}

// Example usage
import java.io.File

/**
 * This function appends new elements to an existing file.
 *
 * @param filename The name of the file to append the elements to.
 * @param elements A list of elements to append.
 */
fun appendElements(filename: String, elements: List<String>) {
import java.io.File

/**
 * This function appends new elements to an existing file.
 *
 * @param filename The name of the file to append the elements to.
 * @param elements A list of elements to append.
 */
fun appendElements(filename: String, elements: List<String>) {

    // Opening the file in append mode
    File(filename).appendText("\n")
    File(filename).bufferedWriter().use { writer ->
        // iterating over the elements
        for (element in elements) {
            // checking if the element is already present in the file
            if (File(filename).readText().contains(element)) {
                println("$element already exists in the file.")
            } else {
                // checking if the element starts with a vowel or a consonant
                if (element[0].toLowerCase() in listOf('a', 'e', 'i', 'o', 'u')) {
                    writer.write("$element is an element starting with a vowel.\n")
                } else {
                    writer.write("$element is an element starting with a consonant.\n")
                }
            }
        }
    }
}

// Example usage