Can I, for example, write a whole new storyline inside my novel, and then say something, for example such as: "just kidding"? Or is that breaking the fourth wall?
You can do it, if you have a narrator who is explicitly speaking to someone. For example, if you have a framing narrative where the protagonist tells the story of his life to another person, or if you have a framing narrative where the protagonist writes down the story of his life (he would then be joking to himself).
If your protagonist directly experiences the story, then the narration is a sort of self-reflection and you can have the "thinker" sugarcoating something to himself and then think to himself: "But who am I kidding?"
Otherwise any address to the reader in a narrative that doesn't address the reader is breaking the fourth wall.
It might be jarring for the reader if it happens in the middle of the text and your text is otherwise in the perspective of the character and not directed at the reader. It is often better to have the character speak to someone else or to use inner monologue.
However, there are other ways to adress the reader directly, for example Terry Pratchett occasionally used footnotes for that purpose. It might not fit for a non-humorous book, but if you are otherwise employing humor, adding a footnote with a remark about the character, story or event might work, e.g.
John punched the bear on the nose and the bear turned around and ran, never to be seen again².
²John actually got eaten by the bear, but this is how he would have told the story if he hadn't died a gruesome death.
It did take an exceptional writer like Terry Pratchett to make them work, so your mileage may vary.
Mark Twain made a brief and cheeky aside of this nature during the famous painting scene in The Adventures of Tom Sawyer, that went like this (emphasis mine):
Tom said to himself that it was not such a hollow world, after all. He had discovered a great law of human action, without knowing it—namely, that in order to make a man or a boy covet a thing, it is only necessary to make the thing difficult to attain. If he had been a great and wise philosopher, like the writer of this book, he would now have comprehended that Work consists of whatever a body is obliged to do, and that Play consists of whatever a body is not obliged to do. And this would help him to understand why constructing artificial flowers or performing on a tread-mill is work, while rolling ten-pins or climbing Mont Blanc is only amusement. There are wealthy gentlemen in England who drive four-horse passenger-coaches twenty or thirty miles on a daily line, in the summer, because the privilege costs them considerable money; but if they were offered wages for the service, that would turn it into work and then they would resign.
Twain doesn't leave the fourth wall unscathed, but left it more scratched or dented than broken.
There are ways that this can be done - for example, if you start a new chapter with Quote marks, go off on some fantastical adventure, and suddenly have it interrupted with the reveal that it's actually a story one of the characters is telling..
For example: your previous chapter ends with the heroes facing off against a villain, and the next chapter starts with an incredible heroics beyond anything they have shown before - only to suddenly be cut off with "Oi, you weren't even there! We actually created a distraction, swiped the macguffin and ran for our lives.", shifting the scene to the pub where everyone gathered afterwards.
In the context you have given, the short answer is "no", but that's not a show-stopper. If you are going to break that wall, then do it with enough style to pull it off.
If on the other hand you meant something besides a literal "just kidding," then perhaps. It would have to be a subtle joke, and would be lost on many readers, but that's fine -- always assume that your readers are smart enough to get your jokes. Those who don't get it will still be fine, and those who do get it will adore you for not spelling out the joke.
An example of this sort of breaking the wall comes in the re-make of Clash of the Titans, in which Our Hero discovers a mechanical owl, and asks if he should take it along. This thing was the annoying Jar-Jar Binks of Clash of the Titans. Somebody tells him not to bother with it, and he discards it. The older people in the audience laughed a lot, and the younger ones didn't.
That was a well-crafted joke, directly from the makers of the movie, told directly to the audience, only using the characters as intermediaries. It was awesome. Did it break the fourth wall? You betcha. But it worked.
Adding onto what others said about PoV and narrator position:
Another take you could take is having "interlude" chapters between sets of main chapters. These interludes can tell side-stories of characters not directly related to the protagonist but tell interesting facts about the world / universe as a whole.
A writer who applies this technique in a great way is Brandon Sanderson in his Stormlight Archives series of books, and a great example of such an interlude that essentially tells a joke is in the latest book in the series "Oathbringer".
Not going to go into spoilers for those who want to read the book but suffice it to say that in Interlude Two Sanderson essentially addresses one of his community's fan theories but does so through an in-world character reading an in-world book (so a character reading a book in a book). This reddit post goes into some more detail about the interlude but let me also put a spoiler warning here
I've seen it done in the movies "True Lies" and also Pixar's "Up", played out where a character imagines a scenario such as violently punching out an obnoxious salesman or letting the kid down on a rope. The audience doesn't know it is hypothetical, but we figure it out soon enough... The camera tells us it was just in the character's head by showing that this absurd result (the man's face bloodied, the kid falling hundreds of feet to the streets below) didn't really happen.
In both of these cases, it was pretty clear that the character was either trying to make up his mind about what to do or restraining his reflexive tendencies, and playing out the situation in his mind to see what he should do.
Then there is the TV series approach of reversing the last 24 episodes by having a character wake up in a past situation (such as before another person's death), showing us that whatever had followed was a dream.
By definition breaking the fourth wall means acknowledging the existence of the audience. If you acknowledge you are a member of a story or that there is an audience outside of it, you are breaking the fourth wall. I would argue this even goes so far as to apply to stories nested inside others. People generally frown upon the breaking of the fourth wall from within the story, as those are people who should not have knowledge of the "outside narrative". Narrators often can do it if they have the right perspective, but still normally shouldn't as it is a distraction to call attention to the framing devices.
That does not mean you should not break the fourth wall. The fourth wall is a tool and it is left in place to leave the reader in the story and keep them from being distracted by the inconsequential.
However, you're not really asking about the fourth wall; What you are asking is with your example is whether your narrator can tell a lie and then admit they were lying. The core of your example is a deception, not necessarily an evil one, and there happens to be a more appropriate convention: Unreliable Narrator. Unreliable Narrators are tough to write well without losing your audience. You are trying to build a relationship of trust, that you are imparting an interesting tail. So, the deceits the narrator dallies in must be more interesting than playing it straight if they are to be successful.
Unreliable narration can be used to comedic effect, as almost anything. But a "just joking" line is likely to be seen as derivative or annoy your readers, so if you're going to do this, I'd advise you to figure out how to stretch and do it well for a good reason.
Whether this would break the fourth wall will depend on the style of the story and how it's done.
If the narration has always contained asides to the audience there will be no fourth wall as such, so this particular instance wouldn't break it.
If not, the way it's done will determine whether it seems like a break to the reader. Appearing to address a specific reader in a more conversational style will be more apparent than vaguely addressing an audience in general. "Just kidding" would be more obvious than "It didn't happen like that", though it might be more in keeping with the overall style of the story - in this case an immediately apparent break might be what you're going for.
Technically when the narrator is addressing the audience this will involve going through the fourth wall, but how this is done will affect whether or not this feels like a break.
While it isn't a joke, you can see a way this could be done in Captain Picard's closing speech in Star Trek: The Next Generation episode Measure of a Man.
Jean-Luc Picard: Now tell me, Commander, what is Data?
Bruce Maddox: I...I don't understand.
Jean-Luc Picard: [shouting] What is he?
Bruce Maddox: A machine!
Jean-Luc Picard: Is he? Are you sure?
Bruce Maddox: Yes!
Jean-Luc Picard: You see, he's already met two of your criteria for sentience, so what about the third? Consciousness, in even the smallest degree! What is he then? I don't know. [to Maddox] Do you? [to Riker] Do you? [to Louvois (the Judge in the case)] Do you?
In the context of the script, the final question is in character posed to JAG Officer Captain Louvouis, however, in the actual episode, Patrick Stewart (playing Picard), turns and faces the camera directly before asking the final iteration of the question "Do you?" Because of this, the viewer is left with a rather pointed challenge of the TV character directly asking the audience if Data meets the third criteria for sentience, what is he? Is he still a machine, as Maddox contends, or is he something else and if so, what?
It is only after this question is asked, that the camera reveals Picard had not broken the fourth wall, but was merely filmed in a way that allowed him to address the audience, but keep the barrier intact. This can be used to make a scene where the main character can seemingly address the audience, by at first concealing a hidden character out of the audience's sight, until it's time to put the wall back.
A good example of this might be Life of Pi (film). The alternative storylines discussed at the end felt almost like breaking the fourth wall but imo didn't actually break it. The same structure could apply to writing.
The story is about a person telling his experience to someone else. The main body of the film is that story. At the end it switches back to the two friends discussing whether that was the best way to tell the story. Or whether the alternative narrative would have been better to tell.
So the fourth wall isn't broken because it's a story within a story. Discussing the narrative is part of the outer story.
To add another example to the pile, P.G. Wodehouse gets a lot of mileage out of the kind of humor where the reader is in on the joke, but the narrator isn't, particularly in the Wooster and Jeeves stories (which are narrated by the amusingly air-headed Wooster). For example, here is the start of "Right Ho, Jeeves":
I don’t know if you have had the same experience, but the snag I always come up against when I’m telling a story is this dashed difficult problem of where to begin it.
It's not a laugh-out-loud joke, but after reading an entire story or novel in this very particular voice, it eventually becomes hilarious. Better examples of the humor I'm talking about are hard to quote in brief, because they rely on plot points that are more or less obvious but Wooster hasn't put together yet.
I would consider this sort of thing to be a joke between the author and the reader, that does not involve breaking the fourth wall.
I've read a couple web-original works where the writer would often end chapters with little vignettes of alternate takes on some of the scenes in the chapter. Frequently funny, rarely entirely in character.
They rarely if ever were directly addressing the reader, but most of the vignettes were references to entirely different stories that the audience might or might not already be fans of.
It wasn't written as part of the actual story at all, but the reading experience was greatly improved by their inclusion.
Prime Example: Harry Potter and the Methods of Rationality. In this case they were given a sub-title of "Omake", meaning "Extra" or "Bonus" in japanese.