Function to calculate sum of two linked lists