Your ArrayBuffer is empty, so you cannot set an element at index i to a new String - index i is not a valid index if the ArrayBuffer is empty. First make sure the elements exist in the ArrayBuffer by adding them:
val strings = ArrayBuffer[String]()
strings += "abc1"
strings += "abc2"
Now the ArrayBuffer has two elements and you can modify them if you want. Note that indices start at 0, not at 1.
strings(0) = "something else"
strings(1) = "hello world"
If you want to pre-fill the ArrayBuffer you can for example use fill, as I showed you in my answer to your previous question.
// Fill with 10 empty strings (creates 10 elements in the ArrayBuffer)
val strings = ArrayBuffer.fill(10) { "" }
// Now you can set them (valid indices are 0...9)
strings(0) = "abc1"
strings(1) = "abc2"
Alternatively, use a Map instead of an ArrayBuffer, where the keys of your map are numbers and the values are strings.
import scala.collection.mutable.Map
val strings: Map[Int, String] = Map()
strings(1) = "abc1"
strings(2) = "abc2"
ArrayBufferbefore you can modify the elements at specific indices.+=as I need to set them with an index