You can use the writeLines() function in R to write lines of text to a file as follows:
fileout <-file("output.txt")
writeLines(c("Hello","World"), fileout)
close(fileout)
The output.txt file will be stored in your current working directory.
If you want to explore more in R programming then watch this R programming tutorial for beginners: