What is the best way to write the contents of ArrayBuffer to CSV file in gatling


I am struggling to write an arrayBuffer to a CSV file and have no luck.

Below is my code snippet

//ArrayBuffer Initialization

var getReqTimeStamp_Arr = new ArrayBufferString
getReqTimeStamp_Arr +=“Get_SS_Req_TimeStamp”
var getReqEID_Arr = new ArrayBufferString
getReqEID_Arr +=“Get_SS_Req_EID”
var getResponseTimeStamp_Arr = new ArrayBufferString
getResponseTimeStamp_Arr +=“Get_SS_Resp_TimeStamp”
var getResponseEID_Arr = new ArrayBufferString
getResponseEID_Arr +=“Get_SS_Resp_EID”

var updateReqTimeStamp_Arr = new ArrayBufferString
updateReqTimeStamp_Arr += “Update_SS_Req_TimeStamp”
var updateReqEID_Arr = new ArrayBufferString
updateReqEID_Arr += “Update_SS_Req_EID”
var updateResponseTimeStamp_Arr = new ArrayBufferString
updateResponseTimeStamp_Arr += “Update_SS_Response_TimeStamp”
var updateResponseEID_Arr = new ArrayBufferString
updateResponseEID_Arr += “Update_SS_Response_EID”

//Saving the values in arrayBuffers as below. There are 1000 values in each arraybuffer

getReqEID_Arr += getReqEid

I want to write this in CSV file. Below code doesn’t work

val out = new BufferedWriter(new FileWriter(“SS_Data.csv”))
val writer = new CSVWriter(out)
.exec(session => {
var listOfRecords = new ListBufferArray[String]

listOfRecords= List(getReqEID_Arr.toArray,getReqTimeStamp_Arr.toArray,getResponseEID_Arr.toArray, getResponseTimeStamp_Arr.toArray,updateReqEID_Arr.toArray,updateReqTimeStamp_Arr.toArray,updateResponseEID_Arr.toArray,updateResponseTimeStamp_Arr)


Getting below error: Any help is appreciated.