The first thing you'll want to do is reduce the monster's hit dice. That makes it inherently less dangerous by reducing BAB, saves, and number of feats, as well as the obvious lessening of hit points.
Lowering HD should also reduce the critter's size, up to a certain point. Since a purple worm is Gargantuan at 16 HD, I'd say make it Huge at 12 HD, Large at 8 HD, and Medium at 4 HD. (I didn't look those numbers up anywhere, I just invented a nice smooth progression.) We'll say that a worm is Medium size at birth, so you'll never see one with less than 4 hit dice.
Ability scores for the standard Gargantuan purple worm have been modified for its size. We can use the "Size Increases" table in the MM to see what those modifiers are, and calculate backward to find the Medium-size baseline. That's three steps in size change (L, H, G), and the modifiers add up to: Str +24, Dex -4, Con +12, Natural Armor +9.
The size change also lowers the damage dice on its natural attacks, by three steps. Poison damage will stay the same, except that the save DC is affected by the lowered Constitution.
It's is also weakened because it has fewer "levels" in Magical Beast. Checking the appropriate table in the MM shows us that a 4-HD Magical Beast has BAB +4, and base saves of: F+4, R+4, Will+1. And very importantly, it has only 2 feats; I'll give it the two Weapon Focus ones, because its Strength is too low to start the Power Attack chain.
Most of the other stuff, like its Tremorsense and whatnot, should stay the same. Even Improved Grab and Swallow Whole still work, but only on creatures no larger than Small.
Apply all the modifiers we've got so far, and the stats block looks something like this:
Purple Worm Hatchling
Medium Magical Beast
Hit Dice: 4d10+4
Abilities: Str 11, Dex 8, Con 13, Int 1, Wis 8, Cha 8
Base Attack/Grapple: +4/+4
Saves: Fort +5, Ref +3, Will +0
Attack: Bite +5 melee (1d6)
Full Attack: Bite +5 melee (1d6) and sting +5 melee (1d4 plus poison, save DC 19)
Feats: Weapon Focus (bite), Weapon Focus (sting)
Skills: Listen +6, Swim +9
As for CR, that's something you kind of have to work out based on how effective the result creature would be in combat. I'd say this beast is probably a CR 3; it has the same hit dice as an ogre, and though it has no reach and much less damage potential, the poison sting partly makes up the difference.
[Edit]Oops, forgot to calculate the AC. It's 15 (+6 natural, -1 Dex).[/edit]