Swift filehandling

Question: Why are repls using Swift unable to write or append to files?

Repl link/Link to where the bug appears: https://replit.com/@Altify-Developm/swift-message-encoder?v=1

Screenshots, links, or other helpful context:

import Swift
import Foundation

// Open the file in append mode
if let fileURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("file.txt") {
    if let fileHandle = try? FileHandle(forWritingTo: fileURL) {
        // Move the file pointer to the end of the file
        // Convert the string to data and write it to the file
        let content = "Now the file has more content!"
        if let data = content.data(using: .utf8) {
        // Close the file handle