Why we need to have a current output on power supply to drive some devices (such as curve tracer)?
You mention a current output but that's not entirely correct. You are probably talking about a current limit setting.

That means the following, say we set the supply to 12 V, 10 mA:


As long as no more than 10 mA is supplied to the load, the voltage will be 12 V. The supply will work in constant voltage mode often shorted as CV.
If you connect a load that wants to make more than 10 mA flow at 12 V, the supply will lower the voltage such that 10 mA flows. It will be in current limiting mode or constant current mode often shorted as CC.
In case you use a resistor as load we can use Ohm's law to find the resistor where the change between CV and CC happens: 12 V/10mA = 1.2 kohm, so a resistor with a value of more than 1.2 kohm will result in a current of less than 10 mA so it will get 12 V (CV). A resistor with a value below 1.2 kohm will want to make more than 10 mA flow at 12 V, the supply does not allow this and will reduce the voltage such that no more than 10 mA flows (CC).



  However, if I connect a 12V and 0A power supply to a 1k ohms, it will have a 12 mA current on the circuit


No, that is not correct, if you set the current to 0 A so no current will flow.
To make the 12 mA you have to set the current limit setting to at least 12 mA.