"In datasheet atmega 328p total arduino pin can source 200 ma of current or some saying 40ma current per pin."
Datasheet says 200mA per VCC and GND pin. I personally confirmed that with Atmel Tech Support (before they were bought by MicroChip).
Absolute max per IO pin is 40mA, more than that and you risk damaging the pin.
Further, above 20mA a High output will begin outputting lower voltage, and a Low output will begin outputting a higher voltage. See Section 32 of the latest datasheet:
"Note: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage
to the device. This is a stress rating only and functional operation of the device at these or other
conditions beyond those indicated in the operational sections of this specification is not implied. Exposure
to absolute maximum rating conditions for extended periods may affect device reliability."
and notes 3 and 4 under table 32.2:
"If IIOH exceeds the test condition (20mA at VCC = 5V, 10mA at VCC =
3V), VOH may exceed the related specification. Pins are not
guaranteed to source current greater than the listed test condition."
"If IOL exceeds the test condition (20mA at VCC = 5V, 10mA at VCC =
3V), VOL may exceed the related specification. Pins are not guaranteed
to sink current greater than the listed test condition."