If you simply want to see the data, you're probably better off using an array to store values. If you do want to use the data log, you're doing most things right. Just one thing, you need to add motor[MotorB] to the datalog, not just MotorB.
What do you mean that it's giving you garbage values? What is the output? As for the title and columns, that type of formatting isn't supported in ROBOTC. For that type of functionality, I recommend that you look at Aswin's NXT2excel program: http://nxttime.wordpress.com/2010/01/20/nxt2excel/