implementing add function for list