Why does a pilot want to hold a Squawk Code when leaving Class B airspace?
The pilot means: I'll be back again, so please don't assign this code to someone else.

Less workload for a pilot going in and out of class-B airspaces, and less hassle for the controllers, so they don't keep assigning a different code to the same plane.

The pilot will switch to the VFR code (1200 in the USA), and then use the one he's written down and used earlier for future passes.