1 - The Rds of 2N5461 is temperature dependent so the output voltage will be temperature dependent
2 - The PWM output is referenced to PIC supply voltage
If this is a school project I think the idea is to use the precision and the temperature stability of LM317 to build a digital controlled voltage source , both ideas have the same lack , if you multiply (first case) or add (the second case) an imprecise value to a precise value you will have an imprecise value at the end. Sorry for the criticism , I'm still searching for an working solution.