I wouldn't bother trying to solve this problem, because the problem doesn't make sense as written. There are two issues:
I.
If the system is in contact with a heat bath at 300 K, then its final temperature should be 300 K, not 310 K.
I suppose the idea could be that the compression is fast enough that the rate at which thermal energy is generated is greater than the rate at which it can flow out to the bath, and that the specified final state is a temporary non-equlibrium state, and that one is calculating the approximate entropy change between an equilibrium and non-equilibrium state. [I say approximate because the non-equilibrium state doesn't have a well-defined entropy.] But, if so, that should have been mentioned explicitly.
II.
The 10 kJ specified for work can't be right. As you may know, the minimum possible compression work is that done with a reversible process. Using that, let's leave aside the details of 300 K vs. 310 K, and try to get a ballpark constraint on the work.
1 kg of air, at an average molecular weight of 28.96 g/mol, is 33.4 moles.
The reversible work to compress 33.4 moles of air at 300 K from 1 bar to 2.5 bar is:
$$w = - n R T \ln \frac{V_f}{V_i} = - n R T \ln \frac{p_i}{p_f}=- n R T \ln \frac{1}{2.5} = 76.3 kJ$$
[With constant T and n, $\frac{V_f}{V_i} = \frac{p_i}{p_f}.$]
This value, which is the work for a reversible process, gives us an approximate lower bound for what the compression work could be (playing with the difference between 300 K and 310 K isn't going to change things much). Thus the 10 kJ value specified in the problem, which is nearly an order of magnitude lower, clearly makes no sense.
Sure, you could get the work down to 10 kJ (indeed, down to 0) by cooling the air to a low temperature, letting it contract, stopping the piston, and heating the air back up. But that's not what the problem specifies.