The sentence is grammatically correct. The conjunction "but" is used to join two clauses that express contrasting ideas. In this case, the first clause states that the man wanted to work all night, while the second clause states that he was completely worn out. The conjunction "and so" is used to join two clauses that express a logical consequence. In this case, the first clause states that the man was completely worn out, and the second clause states that the speaker persuaded him to stop working.