1)
UseCodeTags. That makes your example easier to read.
2) Either
PostRealCode or post an
SSCCE. Your code is neither, it contains several compiler error (RandomAccessfile with lowercase f, rw not being a String, file.length being miss-spelled). Also, you probably meant "first"getBytes(), not "first" + getBytes().
If I fix those errors to the code below I get "firstsecond" appended each time. As such, the code is working as I expect it to.
Just a note: if you want to append Strings to a text file,
you should consider creating a FileWriter with the append flag set to true: