sanity check for memory allocation error
returns head from createCommitmentTree function
adds printLinkedList function
changes return type of createCommitmentTree