You can easily achieve this by using geometry nodes.
(You can use the viewer node to see the changes visually)
I seperated the X-component of the position and passed it through a Math:Modulo to get a repetition. Then used a map range to keep it between one and zero. After that I put it through a color ramp to get a 0-1-0 pattern. Now I put his thorugh a Math: Sine to get a bit of smoothing.(You can use a RGB Curves instead and get the kind of smoothing you want instead)
Now I did the same thing with the Y-component and mixed the two using a Math: Minimum. Then I fed that into Combine XYZ: Z. Now using the set position node, I was able to displace it.
Change the value going into the node groups to change the number of zig-zags.
Change the multiplication value before the combine XYZ to controlthe height.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/h9m4X.png)
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/dvXmm.png)
This is the final result:
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/O8ubG.png)