E.g a teacher asked to the students"what did you yerterday?"then one by one students answered the teacher.after that the teacher said" I baked cookies yesterday "" I brought the cookies for you" then the teacher gave cookies tothe students,the students said thank you teacher.could you tell me why did the teacher use past simple instead of present perfect?? Although it is connected with the present.
I assume you're asking about the sentence "I brought the cookies for you" and why that is not in present perfect tense.
The answer is that she could have answered in the present perfect tense. "I have brought cookies for you" is also acceptable.
Because the bringing has happened in the past (she brought the cookies to school already already), the past simple tense is acceptable. However, as you mentioned, the bringing is very much connected to the present (the cookies are being given to the students now) so the past perfect is technically acceptable too.