It's because you assign data to the current node then create a new node each iteration of the loop. So the last time through the loop, the last node you've created isn't given a value.
Code:
// Before loop, "head" is created
+-----+
| [ ] |
| |
| * |
+-----+
// During loop:
// i = 0, you assign data to the current node and create a new node
+-----+ +-----+
| [0] | | [ ] |
| | | |
| *--|--->| * |
+-----+ +-----+
(new)
// i = 1, you assign data to the current node and create a new node
+-----+ +-----+ +-----+
| [0] | | [1] | | [ ] |
| | | | | |
| *--|--->| *--|--->| * |
+-----+ +-----+ +-----+
(new)
// i = 2, you assign data to the current node and create a new node
+-----+ +-----+ +-----+ +-----+
| [0] | | [1] | | [2] | | [ ] |
| | | | | | | |
| *--|--->| *--|--->| *--|--->| * |
+-----+ +-----+ +-----+ +-----+
(new)
// you break out of the loop, and assign NULL to the last node, which was never given data
+-----+ +-----+ +-----+ +-----+
| [0] | | [1] | | [2] | | [ ] |
| | | | | | | |
| *--|--->| *--|--->| *--|--->| *--|--->NULL
+-----+ +-----+ +-----+ +-----+