You have the right idea, just the wrong execution. (You can try reading this but if it doesn't make sense, try some simpler java tutorials - https://javagoal.com/static-and-non-static-variable-in-java/)
There's a few different options but here's an easy one:
static List<Position> path;
static {
path = new ArrayList<>();
path.add(new Position(x,y,z));
path.add(new Position(x,y,z));
path.add(new Position(x,y,z));
}
// your onLoop would remain the same.