Create file
To store text in a file in the same directory as your robot script:
*** Settings ***
Library OperatingSystem
*** Tasks ***
My Task
${my_file_path}= Set Variable my_file.txt
Create File ${my_file_path} Hello World!
# creates my_file.txt with content Hello World!
Robot framework uses UTF-8 as default file encoding. If you need a different encoding you can specify it like this:
*** Settings ***
Library OperatingSystem
*** Tasks ***
My Task
Create File
... path=my_file.txt
... content=Hello World!
... encoding=cp1250