If you correctly found the solution for [0, L], it means you already have the solution for [-L/2, L/2]: just subtract L/2. But you have overcomplicated the expression for [-L/2, L/2].
[0, L]
[-L/2, L/2]
L/2