Yes, you can go ahead and write a text file into HDFS using Spark.
val filesystem = FileSystem.get(sparkContext.hadoopConfiguration);
val output_stream = filesystem.create(new Path(file));
val buffered_output = BufferedOutputStream(output_stream)
buffered_output.write("My Text".getBytes("UTF-8"))
buffered_output.close()
Important thing to note down is FSDataOutputStream, is object output stream not a text output stream.