Hair production is the result of the cells of the hair follicle depositing layer after layer of protein into this tubular space.
Bolded above are the subject and verb of your sentence; the cells are the noun which carry out the action "to deposit". So the short answer to your question is, it refers to "the cells".
A hair follicle is an object composed of cells, and the thing being deposited is protein. The manner in which the protein is being deposited is "layer by layer". So the sentence has a lot of additional information in it, and I can understand why it could be confusing. A shorter version with less information could have been written:
Hair production is the result of hair follicle cells depositing protein into this space.
However they wanted to give you more information; they wanted you to know how the protein was deposited, they wanted you to know the space was tubular, etc. So they appended some extra information to help paint the picture, which wasn't necessary to make it a grammatical sentence but was necessary to get their point across. And I believe that's where you got confused.
TLDR; "depositing layer after layer of protein" is the action being carried out by "the cells". Those cells just happen to be hair follicle cells.