I arrived at this exact function myself just now while trying to imagine what a "one-dimensional orbit" might look like. I googled "alternating parabola wave" to see if anyone has talked about this, and found this question lol.
In a 3D world, gravity is governed by the inverse-square law. Here's Newton's equation for gravity:
$$|F|=\frac{Gm_1m_2}{r^2}$$
Notice this contains an inverse $r^2$. This is an effect of the inverse-square law, which states that in three dimensions, effects emanating from a point decrease in magnitude proportional to the inverse-square of the distance from the point. The reason for this is that the effect spreads out proportionally to the surface area of a sphere.
This means that in two dimensions, instead of gravity spreading out proportional to the surface area of a sphere, it would spread out proportional to the circumference of a circle, i.e. proportional to the inverse of $|r|$. One can imagine Newton's law of two-dimensional gravitation being the following:
$$|F|=\frac{km_1m_2}{|r|}$$
Likewise, in a one-dimensional world, the effect would not decrease at all and would remain constant. Thus:
$$|F|=km_1m_2$$
This would mean the equation governing the acceleration of an object orbiting a point would be:
$$a=-k*\text{sgn}(x)$$
And, of course, $a=x''$. The solution to this equation is precisely this alternating parabola wave (let's call it $P$), ignoring any constants:
$$x=P(t)$$
Using some trig hacking, I was able to create a single formula for this wave equation:
$$x=\left(1-\frac{2}{5}\left(\arcsin\left(\cos\left(\frac{\pi}{2}t\right)\right)\right)^2\right)*\text{sgn}\left(\sin\left(\frac{\pi}{2}t\right)\right)$$
Here it is in Desmos: https://www.desmos.com/calculator/egn9orerco
I got lost in the math and am still confused about where exactly the $\frac{2}{5}$ came from. But oh well.
PS: It might alternatively be reasonable to assume that the force exerted by one-dimensional gravity would actually not change direction, and would therefore be completely independent of the relative position of the object. This would make the "orbit" a regular parabola. But that's much less fun.