An ex Maths teacher announces he's just been released from a lunatic asylum (as you do) to some people making a film. (He used to teach one of them). He says that he has ideas about the Devil. The filmmakers try to adapt those ideas into a screenplay. Apparently they reject those ideas -after making them - for this film presumably.
The meandering narrative seems to explore scenarios that surround some pretty miserable and uninteresting people. I think I read that it's Bergman's first film to look solely at mild horror and the place of the Devil, both in philosophy, film and in folklore. Suicide, alcoholism, prostitution, even drowning babies born to the under-aged get limp, clumsy and unconvincing treatment.
It's pretty impossible to follow and no doubt spoilt by knowing what gems came later from the Master of Darkness.
Best thing to come out of it was a line that I've slightly altered - "Life Itself is a terminal illness "