Two Lie algebroids are presented that are linked to the construction of the linearizing output of an affine in the input nonlinear system.\ The algorithmic construction of the linearizing output proceeds inductively, and each stage has two structures, namely a codimension one foliation defined through an integrable 1-form $\omega$ , and a transversal vectorfield $g$\ to the foliation. Each integral manifold of the vectorfield $g$ defines an equivalence class of points. Due to transversality, a leaf of the foliation is chosen to represent these equivalence classes. A Lie groupoid is defined with its base given as the particular chosen leaf and with the product induced by the pseudogroup of diffeomorphisms that preserve equivalence classes generated by the integral manifolds of g. Two Lie algebroids associated with this groupoid are then defined. The theory is illustrated with an example using polynomial automorphisms as particular cases of diffeomorphisms and shows the relation with the Jacobian conjecture.