SDHC Datalogging

What could be the problem?

String dataString = "";

There is little memory available on the Arduino. The String class badly fragments that little bit of memory. The free() function that the destructor uses trashes what little isn't badly fragmented.

Therefore, you should NOT be using the String class.

With what you are doing, there is no reason to. Open the file, then read each pin, write the value to the file, write the comma and space, if not at the last pin, then close the file. No need to store all the data into a String.