It sounds like LinkedIn detected some suspicious activity and logged you out. This is a complicated matter, and could actually lead to blocking your account: I would make some attempts with another, expendable, account, if you are using your main one.
There must be something that tells LinkedIn that you are using some bot, or an unusual session. Take a look at this page about blocking bots:
https://docs.apify.com/academy/anti-scraping, and at some tools like this:
https://camoufox.com/. Or, you could try implementing the login process in your workflow, which would be slower, but maybe more reliable.