Shapes which do not define their own data type do not need to add any additional code to support file IO. By default, attributes on your node are saved if they are marked as storable (which is the default) and if there is no input connection to that attribute. If you want to selectively decide which attributes get written and which do not, override the shouldSave() method of MPxNode.
If you define a new type of data, then you must override the writeASCII() and writeBinary() methods of MPxData to support file IO.
For shapes which support tweaking of attribute values (like applying offsets to input history), you may need to do some extra work to specify what should be saved.