Alastair Cook says England have learnt from their failure to bowl Sri Lanka out for victory in the first test.