Controlling XL6009 with MCU
As the resistive divider (or potmeter) is an important part of the feedback in this regulator, you cannot simply remove/replace it with something else as that would influence the feedback loop and the output voltage would not be regulated anymore.
What is possible however is that pulling/pushing a DC current into the voltage divider at the point that is connected the FB pin. The regulator regulates the output voltage by aiming to keep the voltage at the FB pin constant at 1.25 V.

So across R1 there's 1.25 V. No current flows into FB (it is a high impedance input). This means that through R1 (and also R2) 1.25 mA is flowing. That means that the voltage across R2 is 1.25 mA * 13.8 kohm = 17.25 V, add 1.25 V to that and we get the 18.5 V at the output.
Now suppose we pull an extra 0.25 mA from the FB pin to ground and assume that the regulation loop keeps working. Then the voltage at the FB pin remains 1.25 V. Only the current through R2 will increase to 1.25 mA + 0.25 mA = 1.5 mA. Then the voltage across R2 will be 1.5 mA * 13.8 kohm = 20.7 V and the ouput voltage will have increased to 21.95 V.
The challenge is to create a stable DC current from your sensor's signal or PWM signal.
From a PWM signal I'd use an RC filter to convert the PWM signal into a stable DC voltage. Then use a voltage-to-current converter circuit to convert the voltage into a current. Realize that the voltage at the FB pin it only 1.25 V so the voltage-to-current has to be able to work with that. Of course you can make R2 a lot smaller than 13.8 kohm. If you would use 1 kohm then the minimum output voltage becomes 2.5 V and that will increase when current is pulled from the point connected to the FB pin.
By pulling a DC current the feedback loop of the regulator is not affected as any small change of the output voltage is still also present at the voltage at the FB pin.