How come decimal to BCD encoder has 10 input lines
It has 10 input lines, because that's what it's for.

You set one - and only one - of the input lines to true, and it sets the four output lines to the specified bit pattern.  So if you set input 7 to true, it outputs 0111, which is binary for 7.

The truth table doesn't say what happens if you set none of the inputs to true, or if you set more than one of them to true.

In theory, you could add a further 6 inputs, numbered 10 to 15.  But they would generate invalid BCD values.  So those inputs are deliberately omitted.