a simple yet very useful command:
:g/ending/m$
moves lines containing ending to the end of the buffer.
ending
m means move $ means end of buffer, while 0 means beginning of buffer.
m
$
0