Placing line based family

I know, I have that family, but my problem is that I don’t know how I should select the lines in my walls where the family should be placed. If I use this script for the line-based family, it places the family at the wrong places and with incorrect lengths.