Impact of filaments on galaxy formation in their residing dark matter haloes