To write multiple fields to the same record do the following (using your 4 field example).
Instead of:
writev field1 to file,key,1 else...
writev field2 to file,key,2 else...
writev field3 to file,key,3 else...
writev field4 to file,key,4 else...
Use...