What is the reason that Shakespeare put the scene about lechery and sex in Macbeth?
There is only one place in Shakespeare's Macbeth where lechery is mentioned.
In Act II, scene iii, the Porter declares
Lechery is, basically, sexual desire or lustfulness.
The importance of the inclusion of this in the play provides two things. First, the Porter is used as a comic relief. Macbeth is a tragedy. To this point, the play has been filled with the morbid (the murder), the dark and ominous (the witches), and the evil (Lady Macbeth and Macbeth). The Porter, and his rant about being too drunk to have sex, adds some humor to the play.
One could also say that the mentioning of sex by the Porter illuminates the fact that the relationship between Lady Macbeth and Macbeth is not one which is normal. They are too involved with the gaining, and keeping, of the crown to be concerned with the things typically found within a marriage.