Two sections carry this duty, and they cover two different stages of an arrest.
Section 41(1)(b) of the CrPC, now Section 35(1)(b) of the BNSS, applies when the police want to arrest without a warrant for an offence punishable with up to seven years. The officer cannot simply arrest on suspicion; the officer must be satisfied that the arrest is needed for a listed reason, such as stopping further offences or making sure investigation is not hampered, and that satisfaction must be written down as reasons, not just held in the officer's head.
Section 41A(3) of the CrPC, now Section 35A of the BNSS, applies at a later stage, after a notice of appearance has already been served instead of an arrest. If the person ignores that notice, the police may arrest, but again only after recording in writing why arrest, rather than continued notice, has become necessary.
Both sections exist to stop arrest from being an automatic first response, and both were reinforced by the Supreme Court in Arnesh Kumar v. State of Bihar (2014), which made compliance with these recorded reasons a precondition for a valid arrest under either provision.
A simple way to hold both sections in mind is to ask which stage of police contact is in play, because the recording duty attaches to two different stages, not one.
Stage one, first contact with a suspectSo depending on which stage triggered the arrest, the section is either 41(1)(b) CrPC or 35(1)(b) BNSS, or 41A(3) CrPC or 35A BNSS, and in either case, written reasons are the precondition for a lawful arrest.