Finite-temperature effective action for composite operators in the O(N) scalar model