I found a derivation for the formula of logistic regression, it uses the hypothesis concept stated like:

and the derivation that I have doubts is:

For example, in the horizontal line that I marked, why the sign is changed to minus?; and the part that I marked with the diagonal line, where does it come from? From what I see it applies the derivative of ln and the derivative of the product, but I have doubts on the parts that I show.
Any help?
PD. In the derivation part the author is using only one sample, that is why the value of m=1 and the summation disappears.