How crucial is matching the profile of teeth on the pinion?
It depends what you're using it for, how much force is being transferred, what kind of speed it's running at, and how much/little backlash you need in the mechanism...
It's hard to say for certain without knowing the application, but as a rule of thumb it works something like this:
Slow Speed | Profile Not Critical | | High Speed |
Low Forces | ↑← | →↓ | High Forces |
Large Backlash Allowance | | Profile Critical | Little/No Backlash Allowance |
It's important to know that for any of the "Profile Critical" areas, you don't actually want to match the profile of the teeth on the pinion per se, you want to achieve a matching "involute" so that the pinion teeth will have a constant contact area with the rack as the pinion turns.
So if you're hand filing, it would be easiest to print out a template of the involute tooth of a rack of the appropriate module/DP as laying it out geometrically using dividers etc would be inordinately complicated.
Personally I'd consider if I thought I could buy one for a reasonable price and if that was a no, then go to Milling it using a No. 1 Involute cutter of the appropriate size (or for a rack to long to fit on the mill use a form tool in the slotter)...
If you have access to a Mill, Shaper or Slotter (or a friend who does), I would 100% pursue that option before hand-filing the profile, (there's also potential to mount an involute cutter on an arbour between centers in a lathe with the workpiece on the cross-slide table, which would work but be faffy to set up), as it will be substantially faster, run much nicer when meshed with the pinion, and substantially reduce the wear on the mechanism in use.