human
fwrite string to file.
assistant
Here is a Python function to write string to file

import os

def fwrite(file, data):
    """
    Write a string to a file.
    """
    file.write(data)

# Enter the file name
file_name = "test.txt"

# Calling the function
print((fwrite(open(file_name, "w"), "This is a test")))

#Example Output
# None

#Remember to inspect code for bugs.