how the current flows in the dugutal pins?

higherinthesky:
My first message in the Arduino community.

Then a small tip, reread your post (and especially the title) before posting :wink:

The image:
4d0e6ee297b99e3b34f6ecd4396d7fe3a6832bcf.png

And to answer, on the right a pin provides a voltage (when on) aka connects it to the positive of the supply which causes a current flow through the led and resistor to GND.

On the left, the sensor is just a device which needs power to work hence it has a GND and 5V connection. And it just outputs a voltage depending on the temperature.