See the attached to get started.
Also, from stack overflow
fileConn<-file("output.txt")
writeLines(c("Hello","World"), fileConn)
close(fileConn)
ALso see http://cran.r-project.org/web/packages/irtoys/irtoys.pdf
ALso see