Drawing moving object coordinate in x-z direction
If all that's required is to trace its path in the viewport (rather than actually including it in the render) then just selecting the object and clicking the Calculate button in the Motion Paths object properties panel will calculate the path and display it in the viewport.



If, however, you want to include the path in your render then you'll need to create it as actual geometry (eg, a curve that you can add a bevel). This can be achieved using particles (similar to @thibsert's answer) as detailed in How to add trailing light effect to finger tips?.