The center of nilpotent Lie algebra and the last abelian term of the derived series

Let $L$ be a finite-dimensional nilpotent lie algebra. Consider the last non-trivial term of the derived series $A:=[L^n,L^n]$. Is it true that $A$ is equal to the center $Z$ of $L$?

• (a) Every metabelian Lie algebra of nilpotency length $\ge 3$ is a counterexample. (b) There are two nonabelian complex 4-dimensional nilpotent Lie algebras (up to isomorphism) and both are counterexamples (one is covered by Aristide's answer and the other is covered by (a)). – YCor Jul 19 '18 at 20:23

No, consider any nilpotent algebra $L$ which is not commutative. Let $M$ be a commutative algebra. Suppose that $L^n\neq 0$ and $L^{n+1}=0$. The center of $L\oplus M$ is $Z(L) \oplus M$, and$(L\oplus M)^n=L^n$, $(L\oplus M)^{n+1}=0$.