Step 1: Assume the intercepts of the variable line.
Let the variable line meet the \(x\)-axis at
\[
A=(a,0)
\]
and the \(y\)-axis at
\[
B=(0,b)
\]
Step 2: Write the intercept form of the line.
The equation of the line with intercepts \(a\) and \(b\) is
\[
\frac{X}{a}+\frac{Y}{b}=1
\]
Step 3: Use the condition that the line passes through \((l,m)\).
Since the line passes through
\[
(l,m),
\]
we substitute
\[
X=l,\quad Y=m
\]
Thus,
\[
\frac{l}{a}+\frac{m}{b}=1
\]
Step 4: Find the coordinates of \(P\).
Through \(A=(a,0)\), a line parallel to the \(y\)-axis is
\[
X=a
\]
Through \(B=(0,b)\), a line parallel to the \(x\)-axis is
\[
Y=b
\]
These two lines meet at
\[
P=(a,b)
\]
Step 5: Replace \(a,b\) by the coordinates of \(P\).
Let
\[
P=(x,y)
\]
Then,
\[
a=x,\quad b=y
\]
Step 6: Substitute in the relation.
From
\[
\frac{l}{a}+\frac{m}{b}=1
\]
we get
\[
\frac{l}{x}+\frac{m}{y}=1
\]
Step 7: Final conclusion.
Therefore, the locus of \(P\) is
\[
\boxed{\frac{l}{x}+\frac{m}{y}=1}
\]