You are talking more about the first low of thermodynamics (conservation of energy law) than the second. The problem is that the processes you described radiate heat, but it is not explicitly stated that the process of combining of a few photos with low energy to photons with high energy does the same.