What to save in a wallet?
If you want to save your keys as a proper wallet.dat file, you would need to comply with its format.

If you want to store your keys for some other purposes, you only need to save the private keys (public ones can be recreated, you can check out my testing suite for that). You can save them in any format, but Wallet Import Format might be the best choice - it is compact and includes a checksum.