Your question is misguided.
An accountant cannot tell you if it is a good idea to buy shares as this is financial advice (unless they are also fin planners).
Leave this aside - ie whether shares are a good investment or not - you will be able to claim any interest on borrowed money for...