How can I vary the output current and voltage of an Arduino MEGA.?

Hello everyone, I am doing a project with Arduino MEGA I would like to know if you can vary the voltage and output current of the Arduino Mega by means of programming and what are the codes that must be used to be able to control the variation for my project to work , and if you have any idea how to vary the voltages and output currents please wait for me to respond and I am open to any idea.

Thank you very much in advance for your attention and help.

my email is aldair.chacon@gmail.com

You cannot vary the voltage and possible current by changing the code. Theoretically there is the possibility to modify the hardware but it's probably easier to build your own custom hardware that fulfills your needs.

You can use PWM to vary the duty cycle of a pin, making it appear to some devices as though you were varying the voltage.

You can not vary how much current an external circuit draws.