There has been growing interest in motion planning problems for mobile robots. In this field, the main research is to generate a motion for a specific robot and task without previously acquired motions. However it is too wasteful not to use hard-earned acquired motions for other tasks. Here, we focus on a mechanism of reusing acquired motion knowledge and study a motion planning system able to generate and reuse motion knowledge. In this paper, we adopt a tree-based representation for expressing knowledge of motion, and propose a hierarchical knowledge for realizing a reuse mechanism. We construct a motion planning system using hierarchical knowledge as motion knowledge and using genetic programming as a learning method. We apply a proposed method for the gait generation task of a six-legged locomotion robot and show its availability with computer simulation.