Pakistan is building a fence along a disputed part of its border with Afghanistan to prevent armed fighters from entering the country.